/* ============================================================
   grammar-verbwheel.css — Verb Wheel (radial spin).

   Loaded alongside grammar-match.css (shared gm- frame chrome + tokens).
   Ported from the legacy grammar.css vwheel rules; the --vw-* palette is
   remapped onto the gm- tokens so the wheel matches the frame. The
   geometry pixel vars (--tile etc.) are written by the engine's autoFit().
   ============================================================ */

.gm-vw-prompt {
  margin-top: 14px;
  text-align: center;
  font-size: clamp(14px, 3.4vw, 17px);
  color: var(--gm-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gm-vw-actions { display: flex; gap: 8px; align-items: center; }

.grammar-vwheel-active {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  --vw-ink: var(--gm-ink);
  --vw-ink-soft: var(--gm-muted);
  --vw-ink-faint: var(--gm-faint);
  --vw-line: var(--gm-line2);
  --vw-tile-fill: #fff;
  --vw-tile-line: var(--gm-line2);
  --vw-tile-shadow: rgba(60, 48, 30, 0.13);
  --vw-dot-line: var(--gm-line2);
  --vw-dot-empty: var(--gm-line);
  --vw-dot-ink: var(--gm-faint);
  --vw-hub: #383735;
  --vw-accent: var(--gm-acc);
  --vw-accent-glow: rgba(32, 80, 126, 0.18);
  /* Geometry — engine autoFit() overwrites these with scaled px. */
  --tile: 48px;
  --inner-r: 122px;
  --tile-gap: 58px;
  --hub-size: 96px;
  --hub-inset: 0px;
  --cc-cell: 50px;
}

.grammar-vwheel-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.grammar-vwheel-field {
  position: relative;
  min-height: 360px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  overflow: hidden;
}
.grammar-vwheel-field:active { cursor: grabbing; }
.grammar-vwheel-scene { position: absolute; inset: 0; }

.grammar-vwheel-anchor {
  position: absolute;
  top: 50%;
  right: var(--hub-inset);
  width: 0;
  height: 0;
}
.grammar-vwheel-hub {
  position: absolute;
  top: 0; left: 0;
  width: var(--hub-size);
  height: var(--hub-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(120% 120% at 36% 30%,
    color-mix(in oklab, var(--vw-hub) 74%, #ffffff) 0%,
    var(--vw-hub) 52%,
    color-mix(in oklab, var(--vw-hub) 82%, #000000) 100%);
  box-shadow: 0 18px 30px -14px rgba(40, 34, 24, 0.45),
    0 2px 6px rgba(40, 34, 24, 0.18),
    inset 0 2px 3px rgba(255, 255, 255, 0.08);
  z-index: 4;
}
.grammar-vwheel-hub::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -14px;
  transform: translateX(-50%);
  width: 78%; height: 22px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(40, 34, 24, 0.22), transparent 78%);
  z-index: -1;
}

.grammar-vwheel-armset { position: absolute; top: 0; left: 0; z-index: 3; }
.grammar-vwheel-tile {
  position: absolute;
  top: 0; left: 0;
  width: var(--tile);
  height: var(--tile);
  display: grid;
  place-content: center;
  font-family: 'Klee One', 'Noto Sans JP', serif;
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--vw-ink);
  background: var(--vw-tile-fill);
  border: 1.5px solid var(--vw-tile-line);
  border-radius: 12px;
  box-shadow: 0 2px 5px var(--vw-tile-shadow);
  transition: transform 0.30s cubic-bezier(0.34, 1.2, 0.5, 1),
    opacity 0.25s ease, border-color 0.2s, box-shadow 0.2s;
}
.grammar-vwheel-tile-active {
  border-color: var(--vw-accent);
  box-shadow: 0 4px 11px -2px rgba(60, 48, 30, 0.18),
    0 0 0 3px var(--vw-accent-glow);
}
.grammar-vwheel-field.grammar-vwheel-dragging .grammar-vwheel-tile,
.grammar-vwheel-field.grammar-vwheel-dragging .grammar-vwheel-creel,
.grammar-vwheel-field.grammar-vwheel-dragging .grammar-vwheel-cell,
.grammar-vwheel-field.grammar-vwheel-dragging .grammar-vwheel-anchor {
  transition: none !important;
}

.grammar-vwheel-creel {
  position: absolute;
  display: grid;
  z-index: 3;
  transition: transform 0.30s cubic-bezier(0.34, 1.2, 0.5, 1);
  font-family: 'Klee One', 'Noto Sans JP', serif;
  font-weight: 600;
}
.grammar-vwheel-cell {
  width: var(--cc-cell);
  height: var(--cc-cell);
  display: grid;
  place-content: center;
  font-size: 1.38rem;
  color: var(--vw-ink);
  border-radius: 12px;
  transition: transform 0.30s cubic-bezier(0.34, 1.2, 0.5, 1), border-color 0.2s, box-shadow 0.2s;
}
.grammar-vwheel-cell-stem {
  background: var(--vw-tile-fill);
  border: 1.5px solid var(--vw-tile-line);
  box-shadow: 0 2px 5px var(--vw-tile-shadow);
}
.grammar-vwheel-cell-ending {
  background: transparent;
  border: 2.5px dotted var(--vw-dot-line);
  color: var(--vw-dot-ink);
}
.grammar-vwheel-cell-empty {
  background: transparent;
  border: 2.5px dotted var(--vw-dot-empty);
}
.grammar-vwheel-cell-row-active {
  border-color: var(--vw-accent);
  box-shadow: 0 2px 5px var(--vw-tile-shadow), 0 0 0 3px var(--vw-accent-glow);
}

/* Matched: the active arm/stem go green on a correct Check. */
.grammar-vwheel-active.is-matched .grammar-vwheel-tile-active,
.grammar-vwheel-active.is-matched .grammar-vwheel-cell-row-active {
  border-color: var(--gm-green) !important;
  box-shadow: 0 2px 5px var(--vw-tile-shadow), 0 0 0 3px rgba(47, 143, 91, 0.2) !important;
}

.grammar-vwheel-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  min-height: 84px;
  max-height: 84px;
  overflow: hidden;
}
.grammar-vwheel-ro-form-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  white-space: nowrap;
}
.grammar-vwheel-ro-meaning-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 28px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}
.grammar-vwheel-ro-dict {
  font-family: 'Klee One', 'Noto Sans JP', serif;
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--vw-ink-soft);
  flex-shrink: 0;
}
.grammar-vwheel-ro-arrow { color: var(--vw-ink-faint); font-size: 1.25rem; flex-shrink: 0; }
.grammar-vwheel-ro-form {
  font-family: 'Klee One', 'Noto Sans JP', serif;
  font-weight: 600;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--vw-ink);
  flex-shrink: 0;
}
.grammar-vwheel-ro-form .grammar-vwheel-suffix { color: var(--vw-accent); }
.grammar-vwheel-ro-gloss {
  color: var(--vw-ink-soft);
  font-size: 1rem;
  font-style: italic;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grammar-vwheel-reveal-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--vw-ink-soft);
  background: transparent;
  border: 1px dashed var(--vw-line);
  border-radius: 999px;
  padding: 3px 12px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
@media (hover: hover) {
  .grammar-vwheel-reveal-btn:hover {
    background: var(--vw-tile-fill);
    border-color: var(--vw-accent);
    color: var(--vw-ink);
  }
}

.grammar-vwheel-nudge {
  position: absolute;
  left: 44%; top: 78%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--vw-ink-faint);
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.4s ease;
}
.grammar-vwheel-nudge-chev { font-size: 1.4rem; animation: grammarVwheelBob 1.6s ease-in-out infinite; }
.grammar-vwheel-nudge-txt { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
@keyframes grammarVwheelBob {
  0%, 100% { transform: translateY(3px); opacity: 0.55; }
  50% { transform: translateY(-4px); opacity: 1; }
}
.grammar-vwheel-field.grammar-vwheel-touched .grammar-vwheel-nudge { opacity: 0; }

@media (max-width: 760px) {
  .grammar-vwheel-field { min-height: 280px; }
  .grammar-vwheel-ro-form { font-size: 1.7rem; }
  .grammar-vwheel-ro-dict { font-size: 1.2rem; }
}
