/* ─── Action panel ────────────────────────────────────────────────────── */

.action-panel {
  position: absolute;
  left: var(--cell-center-x);
  bottom: calc(100% - var(--cell-top-y) + 4px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  white-space: nowrap;
  z-index: 10;
  transform: translateX(-50%) scale(0.88);
  transform-origin: 50% calc(100% + 10px);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s ease-out, transform 0.12s ease-out, visibility 0s 0.12s;
}

/* Forms need wrapping text, more space, and a minimum width */
.action-panel.has-form {
  white-space: normal;
  min-width: 180px;
  gap: 10px;
}

.action-panel.active {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) scale(1);
  transition: opacity 0.12s ease-out, transform 0.12s ease-out, visibility 0s 0s;
}

/* Centered variant — used for inventory-sourced forms (no canvas tile to anchor to) */
.action-panel.centered {
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translateX(-50%) translateY(-50%) scale(0.88);
  transform-origin: 50% 50%;
}
.action-panel.centered::before,
.action-panel.centered::after { display: none; }
.action-panel.centered.active {
  transform: translateX(-50%) translateY(-50%) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .action-panel { transition: none; }
}

/* ─── Player action panel ───────────────────────────────────────────────── */

.action-panel--player { gap: 0; }

/* Description: no bottom margin — divider sits right below it */
.action-panel--player .action-panel-desc { margin: 0 0 4px; }

/* Action buttons get breathing room below the divider */
.action-panel--player .action-panel-btn { margin-top: 8px; }

/* Divider between description and actions */
.player-divider {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.55;
}
.player-divider::before,
.player-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider-gold);
}
.player-divider span {
  font-family: Georgia, 'Palatino Linotype', serif;
  font-size: 8px;
  color: var(--divider-gold);
  flex-shrink: 0;
}

.action-panel-type {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--fg-2);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}

.action-panel-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--accent);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 3px 0;
  text-align: left;
  text-transform: capitalize;
  display: flex;
  align-items: center;
}

.action-panel-btn:hover { opacity: 0.75; }
.action-panel-btn:active { transform: translateY(1px); }

.action-panel-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.action-panel-btn--cancel { color: var(--fg-2); opacity: 0.55; }
.action-panel-btn--cancel:hover { opacity: 0.9; }

.action-panel-btn.not-affordable {
  opacity: 0.35;
  cursor: not-allowed;
  color: var(--muted);
}
.action-panel-btn.not-affordable:hover { opacity: 0.35; }
.action-panel-btn.not-affordable:active { transform: none; }

.action-panel-desc {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--accent);
  margin: 2px 0 6px;
  font-style: italic;
  line-height: 1.6;
  max-width: 140px;
  white-space: normal;
}

/* ─── Give / Drop forms ────────────────────────────────────────────────── */

/* Item emoji picker */
.give-item-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.give-item-chip {
  font-size: 18px;
  background: none;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.1s, border-color 0.1s;
  line-height: 1;
}
.give-item-chip:hover { opacity: 0.8; }
.give-item-chip.is-selected {
  opacity: 1;
  border-color: var(--accent);
}

/* Drop item display */
.drop-item-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.drop-item-emoji { font-size: 22px; line-height: 1; }
.drop-item-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--fg-2);
}

/* Qty stepper: large number above, slider below */
.give-qty-stepper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.give-qty-value {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  text-align: center;
  color: var(--fg);
  line-height: 1;
}

.give-qty-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  cursor: pointer;
  accent-color: var(--accent);
}

.give-qty-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.give-qty-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Underline message input */
.give-message-input {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  padding: 3px 0;
}

.give-message-input::placeholder { color: var(--faint); }
.give-message-input:focus { outline: none; border-bottom-color: var(--accent); }

/* Buttons: cancel left, confirm right */
.give-btn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.give-confirm-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  text-transform: capitalize;
  line-height: 1;
}
.give-confirm-btn:hover { opacity: 0.85; }
.give-confirm-btn:active { transform: translateY(1px); }

/* ── Plant direction grid ────────────────────────────── */
.plant-dir-grid {
  display: grid;
  grid-template-columns: repeat(3, 32px);
  grid-template-rows: repeat(3, 32px);
  gap: 3px;
  margin: 6px auto;
}

.plant-dir-btn {
  width: 32px;
  height: 32px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.plant-dir-btn:not(:disabled):hover {
  background: var(--border);
}

.plant-dir-btn:not(:disabled):active {
  transform: scale(0.9);
}

.plant-dir-btn:disabled {
  cursor: default;
  opacity: 1;
}
