:root {
  --app-viewport-height: 100dvh;
  --bg: #f3f5fa;
  --ink: #172033;
  --muted: #69738a;
  --card: #fff;
  --board: #28344d;
  --red: #ff5364;
  --green: #42c879;
  --blue: #4e8df7;
  --yellow: #f7c83d;
  --purple: #a674ed;
  font-family: ui-rounded, "Hiragino Maru Gothic ProN", "Yu Gothic", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  color: var(--ink);
  background: var(--bg);
  -webkit-touch-callout: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: var(--app-viewport-height);
  min-height: 0;
  padding: 8px;
  overflow: hidden;
}

.play-area {
  display: flex;
  flex: 1;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  gap: 8px;
}

.board-card {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 4px;
  background: transparent;
  border: 0;
  border-radius: 16px;
  box-shadow: none;
  container-type: size;
}

.tokopuyo-field-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

body[data-mode="tokopuyo"] .tokopuyo-field-stack {
  transform: translateY(14px);
}

.tokopuyo-chain-readout {
  margin: 8px 0 0;
  color: #59657b;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

body[data-mode="tokopuyo"] .board-card {
  touch-action: none;
}

.board-wrap {
  position: relative;
  width: min(100%, calc(46.153svh + 0.153px));
  max-width: 100%;
  height: auto;
  padding: 7px;
  aspect-ratio: auto;
  background: var(--board);
  border-radius: 15px;
  box-shadow: inset 0 2px 5px #111a2d80;
}

@supports (width: 1cqw) {
  .board-wrap {
    /* Size the field from its card, not the full viewport. */
    width: min(100cqw, calc(46.153cqh + 7.539px));
  }

  body[data-mode="tokopuyo"] .board-wrap {
    /* Leave room for the score, lower controls, and pair preview. */
    width: min(100cqw, calc(42.857cqh + 7.539px));
  }
}

.suggestion-loading {
  position: absolute;
  inset: 7px;
  z-index: 4;
  display: grid;
  place-items: center;
  background: #172033a6;
  border-radius: 9px;
  pointer-events: all;
}

.suggestion-loading[hidden] {
  display: none;
}

.drawing-only[hidden],
.tokopuyo-only[hidden],
.tokopuyo-preview[hidden],
.tokopuyo-controls[hidden],
.chain-badge[hidden],
.tokopuyo-chain-readout[hidden],
.active-pair-layer[hidden],
#drawingHelp[hidden],
#tokopuyoHelp[hidden] {
  display: none;
}

.active-pair-layer {
  position: absolute;
  z-index: 6;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.active-puyo {
  position: absolute;
  padding: 0;
  pointer-events: none;
  border: 3px solid #fff9;
  border-radius: 50%;
  box-shadow: inset -4px -5px 0 #0000001c, inset 3px 3px 0 #ffffff38,
    0 3px 7px #10182788;
  transform: translate(-50%, -50%);
  touch-action: none;
}

.active-puyo::after,
.preview-puyo::after {
  position: absolute;
  top: 17%;
  left: 20%;
  width: 26%;
  height: 17%;
  content: "";
  background: #fff9;
  border-radius: 50%;
  transform: rotate(-25deg);
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #ffffff4d;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.board {
  display: grid;
  grid-template-rows: repeat(13, minmax(0, 1fr));
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: 100%;
  height: auto;
  aspect-ratio: 6 / 13;
}

.cell {
  position: relative;
  min-width: 0;
  margin: 2px;
  padding: 0;
  background: #394762;
  border: 0;
  border-radius: 7px;
  box-shadow: inset 0 2px 2px #ffffff12;
  touch-action: none;
}

.cell.hidden-cell {
  background: #303b55;
}

.cell.hidden-boundary {
  border-bottom: 2px dashed #93a0bc88;
}

.cell:focus-visible {
  z-index: 2;
  outline: 3px solid #fff;
  outline-offset: 1px;
}

.puyo {
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  box-shadow: inset -4px -5px 0 #0000001c, inset 3px 3px 0 #ffffff38,
    0 2px 3px #10182755;
  animation: pop 0.16s ease-out;
}

.puyo.garbage {
  background: #8c96a8;
}

.puyo::after {
  position: absolute;
  top: 17%;
  left: 20%;
  width: 26%;
  height: 17%;
  content: "";
  background: #fff9;
  border-radius: 50%;
  transform: rotate(-25deg);
}

.suggestion-marker {
  position: absolute;
  z-index: 3;
  inset: 13%;
  pointer-events: none;
  border: max(2px, 0.15vw) dashed currentColor;
  border-radius: 50%;
  background: transparent !important;
  filter: drop-shadow(0 1px 1px #10182766);
  opacity: 0.95;
}

.suggestion-marker.red { color: var(--red); }
.suggestion-marker.green { color: var(--green); }
.suggestion-marker.blue { color: var(--blue); }
.suggestion-marker.yellow { color: var(--yellow); }
.suggestion-marker.purple { color: var(--purple); }

.suggestion-marker.trigger::after {
  position: absolute;
  display: grid;
  inset: 0;
  place-items: center;
  content: "✦";
  color: currentColor;
  font-size: clamp(12px, 3.2vw, 20px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px #10182788, 0 0 3px #fff;
}

.suggestion-marker.current::after {
  position: absolute;
  display: grid;
  inset: 0;
  place-items: center;
  content: "✦";
  color: currentColor;
  font-size: clamp(12px, 3.2vw, 20px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px #10182788, 0 0 3px #fff;
}

.suggestion-marker.future {
  inset: 17%;
  opacity: 0.68;
}

.suggestion-marker.future::after {
  position: absolute;
  display: grid;
  right: -7px;
  bottom: -7px;
  width: 16px;
  height: 16px;
  place-items: center;
  content: attr(data-step);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  background: currentColor;
  border: 1px solid #fff;
  border-radius: 50%;
  text-shadow: 0 1px 1px #10182799;
}

.chain-group-overlay {
  position: absolute;
  display: grid;
  inset: 0;
  z-index: 4;
  place-items: center;
  pointer-events: none;
}

.suggestion-group-label {
  position: absolute;
  display: grid;
  inset: 0;
  place-items: center;
  color: #fff;
  font-size: clamp(12px, 3.2vw, 20px);
  font-weight: 900;
  line-height: 1;
  background: transparent;
  text-shadow: 0 1px 2px #10182799, 0 0 3px #101827;
}

.suggestion-marker.probe {
  inset: 13%;
  z-index: 3;
  border-radius: 50% !important;
  border-style: dotted !important;
  border-color: currentColor !important;
  background: transparent !important;
  opacity: 1;
  filter: drop-shadow(0 0 4px currentColor);
}

.suggestion-marker.probe::after {
  position: absolute;
  display: grid;
  inset: 0;
  place-items: center;
  content: "ϟ";
  color: currentColor;
  font-size: clamp(15px, 4.2vw, 26px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px #10182788, 0 0 3px #fff;
}

.suggestion-marker.virtual-suggestion-marker {
  inset: auto;
  transform: translate(-50%, -50%);
}

.suggestion-marker.ignition-target {
  inset: 5%;
  border: 3px solid #fff;
  outline: 3px solid currentColor;
  outline-offset: -1px;
  opacity: 1;
  filter: drop-shadow(0 0 5px currentColor);
  box-shadow: inset 0 0 7px currentColor, 0 0 5px currentColor;
}

.suggestion-marker.ignition-target.ignition-ready {
  animation: ignition-pulse 1.25s ease-in-out infinite alternate;
}

.red { background: var(--red); }
.green { background: var(--green); }
.blue { background: var(--blue); }
.yellow { background: var(--yellow); }
.purple { background: var(--purple); }

.cell.clearing .puyo {
  animation: vanish 0.35s ease-in forwards;
}

.review-mini-puyo.clearing {
  animation: vanish 0.35s ease-in forwards;
}

.dead-mark {
  position: absolute;
  z-index: 2;
  display: grid;
  inset: 3%;
  place-items: center;
  color: #ff9a9a;
  font-size: clamp(15px, 4vw, 24px);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 1px 3px #11182799;
}

.left-sidebar,
.toolbar {
  --sidebar-size: clamp(44px, 12vw, 58px);
}

.left-sidebar {
  display: flex;
  flex: 0 0 var(--sidebar-size);
  flex-direction: column;
  align-items: center;
  width: var(--sidebar-size);
  gap: 10px;
  padding: 4px 0;
}

.toolbar {
  display: flex;
  flex: 0 0 calc(var(--sidebar-size) + 4px);
  flex-direction: column;
  align-items: center;
  width: calc(var(--sidebar-size) + 4px);
  gap: 10px;
  margin: 0;
  padding: 4px 0;
  background: transparent;
  border: 0;
}

.tokopuyo-controls {
  display: flex;
  flex: 0 0 78px;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  margin: 8px -8px -8px;
  padding: 8px max(16px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #fff;
  border-top: 1px solid #dce2ed;
  box-shadow: 0 -5px 16px #28344d18;
}

.pair-movement-controls,
.pair-action-controls {
  display: flex;
  gap: 8px;
}

.pair-control-btn {
  display: grid;
  width: clamp(48px, 14vw, 64px);
  height: clamp(48px, 14vw, 64px);
  padding: 0;
  place-items: center;
  color: #42506b;
  font-size: clamp(26px, 8vw, 35px);
  font-weight: 900;
  line-height: 1;
  background: #f1f4f9;
  border: 1px solid #d6ddea;
  border-radius: 16px;
  box-shadow: inset 0 1px #fff, 0 3px 7px #28344d18;
}

.pair-control-icon {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pair-control-btn:active:not(:disabled) {
  background: #e1e8f4;
  box-shadow: inset 0 2px 5px #28344d22;
  transform: translateY(1px);
}

.pair-drop-btn {
  color: #fff;
  background: linear-gradient(145deg, #ff6676, #df4056);
  border-color: #d93c52;
}

.pair-drop-btn:active:not(:disabled) {
  background: #d94156;
}

.tokopuyo-step-controls {
  justify-content: center;
  gap: clamp(4px, 1.5vw, 8px);
}

.tokopuyo-step-controls .pair-control-btn {
  width: clamp(40px, 12vw, 56px);
  height: clamp(40px, 12vw, 56px);
}

.tokopuyo-preview {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  align-self: flex-end;
  justify-content: center;
  width: calc(var(--sidebar-size) * 1.5);
  height: 90px;
  margin-top: calc(-1 * (max(8px, env(safe-area-inset-top)) + 4px));
  margin-right: calc(-1 * max(8px, env(safe-area-inset-right)));
  padding: 5px 3px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.preview-pairs {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.preview-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.preview-group small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.preview-group.next-next {
  opacity: 0.78;
}

.preview-pair {
  display: flex;
  flex-direction: column;
}

.preview-puyo {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
  margin-top: -1px;
  overflow: hidden;
  border-radius: 50%;
  box-shadow: inset -2px -2px 0 #0002, inset 2px 2px 0 #fff5;
}

.next-next .preview-puyo {
  width: 18px;
  height: 18px;
}

.pattern-number {
  margin-top: 4px;
  color: #59657b;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
}

.chain-badge {
  appearance: none;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  width: var(--sidebar-size);
  height: var(--sidebar-size);
  min-height: var(--sidebar-size);
  padding: 5px;
  color: #fff;
  text-align: center;
  background: linear-gradient(145deg, #556584, #293650);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 8px 18px #29365030;
}

.chain-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  line-height: 1;
}

.chain-line span {
  min-width: 0;
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.chain-line small {
  flex: 0 0 auto;
  font-size: 8px;
  font-weight: 700;
}

.sidebar-actions,
.simulation-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-btn,
.help-btn,
.left-sidebar .reset-btn,
.toolbar .primary-btn,
.toolbar .reset-btn {
  width: var(--sidebar-size);
  height: var(--sidebar-size);
  min-height: var(--sidebar-size);
  flex: 0 0 var(--sidebar-size);
  padding: 0;
  border-radius: 14px;
}

.left-sidebar .reset-btn,
.toolbar .reset-btn {
  color: #4f5b73;
  background: #fff;
  border: 0;
  box-shadow: 0 5px 12px #28344d20;
}

.sidebar-btn {
  color: #4f5b73;
  font-size: 23px;
  background: #fff;
  border: 0;
  box-shadow: 0 5px 12px #28344d20;
}

.primary-btn {
  color: #fff;
  font-weight: 800;
  background: linear-gradient(145deg, #ff6676, #df4056);
  border: 1px solid #d93c52;
  border-radius: 14px;
  box-shadow: 0 5px 12px #ef536440;
}

.primary-btn:active:not(:disabled) {
  background: #d94156;
  box-shadow: inset 0 2px 5px #7d1f2d55;
  transform: translateY(1px);
}

.step-mode-icon {
  display: block;
  width: 29px;
  height: 29px;
  margin-inline: auto;
  fill: currentColor;
}

.step-control-icon {
  display: block;
  width: 34px;
  height: 34px;
  fill: currentColor;
}

#toggleTokopuyoStepMode.active {
  color: #fff;
  background: linear-gradient(145deg, #6aa7ff, #3977d9);
  box-shadow: 0 5px 12px #3977d940;
}

.mode-btn.active {
  color: #fff;
  background: linear-gradient(145deg, #6aa7ff, #3977d9);
  box-shadow: 0 5px 12px #3977d940;
}

.toolbar-divider {
  width: calc(100% - 8px);
  height: 1px;
  flex: 0 0 1px;
  margin: 3px 0;
  background: #b9c1d080;
}

.mode-garbage-icon {
  display: block;
  width: 24px;
  height: 24px;
  margin: auto;
  background: #8c96a8;
  border-radius: 50%;
  box-shadow: inset -3px -3px #0002, inset 2px 2px #fff5;
}

.mode-pair-icon {
  position: relative;
  display: block;
  width: 28px;
  height: 30px;
  margin: auto;
}

.mode-pair-icon i {
  position: absolute;
  left: 6px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  box-shadow: inset -2px -2px #0002, inset 2px 2px #fff5;
}

.mode-pair-icon i:first-child {
  top: 0;
  background: var(--red);
}

.mode-pair-icon i:last-child {
  bottom: 0;
  background: var(--blue);
}

.tsumo-search-icon {
  display: block;
  width: min(30px, calc(var(--sidebar-size) - 16px));
  height: min(30px, calc(var(--sidebar-size) - 16px));
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
}

.drawing-mode-icon {
  display: block;
  width: 30px;
  height: 30px;
  margin: auto;
  color: #4f5b73;
  fill: currentColor;
}

.app-mode-btn {
  position: relative;
}

.app-mode-btn::after {
  position: absolute;
  right: calc(50% - 17px);
  bottom: calc(50% - 17px);
  width: 16px;
  height: 16px;
  content: "";
  background: rgb(255 255 255 / 72%) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 20c-1-7 2-13 10-13h6M15 3l5 4-5 4' fill='none' stroke='%234f5b73' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  border: 0;
  border-radius: 5px;
  filter: drop-shadow(0 1px 1px #28344d40);
  pointer-events: none;
}

.custom-tokopuyo-start-btn {
  position: relative;
  color: #4f5b73;
}

.custom-tokopuyo-start-btn:disabled {
  color: #aeb7c7;
  background: #e7ebf2;
  box-shadow: none;
  cursor: not-allowed;
}

.custom-tokopuyo-start-icon {
  display: block;
  width: 31px;
  height: 31px;
  margin: auto;
  fill: var(--red);
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.custom-tokopuyo-start-icon circle:last-of-type { fill: var(--blue); }

.custom-tokopuyo-start-btn:disabled .custom-tokopuyo-start-icon {
  fill: currentColor;
  opacity: 0.72;
}

body[data-mode="drawing"] .help-btn {
  margin-top: auto;
}

.palette-icon {
  display: grid;
  grid-template-columns: repeat(2, 10px);
  grid-template-rows: repeat(2, 10px);
  align-content: center;
  justify-content: center;
  gap: 2px;
  width: 26px;
  height: 26px;
  margin: auto;
}

.palette-icon i {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset -1px -1px #0002, inset 1px 1px #fff5;
}

.palette-icon i.red { background: var(--red); }
.palette-icon i.green { background: var(--green); }
.palette-icon i.blue { background: var(--blue); }
.palette-icon i.yellow { background: var(--yellow); }
.palette-icon i.purple { background: var(--purple); }

.palette-cycle-btn[data-five-color="true"] .palette-icon {
  grid-template-columns: repeat(3, 7px);
  grid-template-rows: repeat(3, 7px);
  gap: 2px;
}

.palette-cycle-btn[data-five-color="true"] .palette-icon i {
  width: 7px;
  height: 7px;
}

.palette-cycle-btn[data-five-color="true"] .palette-icon i:nth-child(1) {
  grid-row: 1;
  grid-column: 1;
}

.palette-cycle-btn[data-five-color="true"] .palette-icon i:nth-child(2) {
  grid-row: 1;
  grid-column: 3;
}

.palette-cycle-btn[data-five-color="true"] .palette-icon i:nth-child(3) {
  grid-row: 3;
  grid-column: 1;
}

.palette-cycle-btn[data-five-color="true"] .palette-icon i:nth-child(4) {
  grid-row: 3;
  grid-column: 3;
}

.palette-cycle-btn[data-five-color="true"] .palette-icon i:nth-child(5) {
  grid-row: 2;
  grid-column: 2;
}

.palette-help-icon {
  gap: 0;
}

.palette-help-icon .palette-icon {
  grid-template-columns: repeat(3, 5px);
  grid-template-rows: repeat(3, 5px);
  width: 17px;
  height: 17px;
  gap: 1px;
}

.palette-help-icon .palette-icon i {
  width: 5px;
  height: 5px;
}

.palette-help-icon .palette-icon i:nth-child(1) {
  grid-row: 1;
  grid-column: 1;
}

.palette-help-icon .palette-icon i:nth-child(2) {
  grid-row: 1;
  grid-column: 3;
}

.palette-help-icon .palette-icon i:nth-child(3) {
  grid-row: 3;
  grid-column: 1;
}

.palette-help-icon .palette-icon i:nth-child(4) {
  grid-row: 3;
  grid-column: 3;
}

.palette-help-icon .palette-icon i:nth-child(5) {
  grid-row: 2;
  grid-column: 2;
}

.mode-help-icon {
  font-size: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.help-btn {
  position: relative;
  color: #4f5b73;
  background: #fff;
  border: 0;
  box-shadow: 0 5px 12px #28344d20;
}

.left-sidebar .help-btn {
  margin-top: auto;
}

.history-icon {
  display: block;
  width: 27px;
  height: 27px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.suggestion-icon {
  display: block;
  width: 27px;
  height: 27px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reset-icon {
  width: 28px;
  height: 28px;
  stroke-width: 2.8;
  transform: translate(-1px, -1px);
}

.toolbar .primary-btn,
.toolbar .reset-btn {
  font-size: 23px;
}

.toolbar .primary-btn {
  color: #fff;
  background: #ef5364;
  border: 0;
  box-shadow: 0 5px 12px #ef536440;
}

.toolbar .primary-btn:disabled {
  color: #eef0f4;
  background: #aeb6c4;
  box-shadow: none;
}

.secondary-btn:disabled,
.primary-btn:disabled {
  cursor: default;
  opacity: 0.36;
}

.sidebar-btn:disabled {
  color: #aeb5c3;
  background: #e6e9f0;
  box-shadow: none;
}

.palette,
.action-row,
.status {
  display: none;
}

.flick-menu {
  position: fixed;
  z-index: 10;
  width: 174px;
  height: 174px;
  pointer-events: none;
  background: #172033d9;
  border-radius: 50%;
  box-shadow: 0 7px 22px #17203345;
  transform: translate(-50%, -50%);
}

.flick-menu.modal-flick-menu { z-index: 34; }

.toast {
  position: fixed;
  top: 6px;
  z-index: 12;
  max-width: none;
  padding: 10px 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  background: #172033d9;
  border: 1px solid #ffffff26;
  border-radius: 999px;
  box-shadow: 0 5px 16px #17203345;
  white-space: normal;
  overflow-wrap: anywhere;
}

.flick-menu::after {
  display: none;
}

.flick-option {
  position: absolute;
  width: 46px;
  height: 46px;
  padding: 0;
  pointer-events: auto;
  background: #fff;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 7px #11182766;
  transform: translate(-50%, -50%);
}

.flick-option[data-tool] > i {
  display: block;
  width: 24px;
  height: 24px;
  margin: auto;
  border-radius: 50%;
  box-shadow: inset -3px -3px #0002, inset 2px 2px #fff5;
}

.flick-option[data-tool="red"] i { background: var(--red); }
.flick-option[data-tool="green"] i { background: var(--green); }
.flick-option[data-tool="blue"] i { background: var(--blue); }
.flick-option[data-tool="yellow"] i { background: var(--yellow); }
.flick-option[data-tool="purple"] i { background: var(--purple); }

.flick-option[data-tool="garbage"] {
  background: #fff;
}

.flick-option[data-tool="garbage"] i {
  background: #8c96a8;
}

.flick-option[data-tool="erase"] {
  color: #59657b;
  font-size: 22px;
}

.flick-option.active {
  outline: 3px solid #fff8;
  transform: translate(-50%, -50%) scale(1.18) !important;
}

.flick-center {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: #fff;
  border: 2px solid #dbe0ea;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.flick-center.active {
  outline: 3px solid #fff8;
  transform: translate(-50%, -50%) scale(1.18);
}

.flick-delete {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #59657b;
  font-size: 22px;
  background: #fff;
  border: 2px solid #dbe0ea;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.help-btn {
  margin-top: auto;
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 700;
  font-style: italic;
}

.help-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: #10182788;
  overscroll-behavior: contain;
}

.custom-tokopuyo-overlay {
  position: fixed;
  z-index: 32;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: #10182799;
  overscroll-behavior: contain;
}

.custom-tokopuyo-overlay[hidden] { display: none; }

.tsumo-search-overlay {
  position: fixed;
  z-index: 33;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: #10182799;
  overscroll-behavior: contain;
}

.tsumo-search-overlay[hidden] { display: none; }

.tsumo-search-card {
  position: relative;
  width: min(100%, 460px);
  max-height: calc(100svh - 32px);
  padding: 28px 20px 20px;
  overflow-y: auto;
  color: var(--ink);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 18px 50px #10182766;
  overscroll-behavior: contain;
}

.tsumo-search-card h2 {
  margin: 0 40px 8px 0;
  font-size: 21px;
  line-height: 1.25;
}

.tsumo-search-intro,
.tsumo-search-hint {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tsumo-search-field {
  display: block;
  margin-top: 18px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.tsumo-search-field input {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 6px;
  padding: 8px 12px;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  letter-spacing: 0.08em;
  background: #f4f6fa;
  border: 2px solid #d8dfeb;
  border-radius: 10px;
  outline: 0;
  user-select: text;
  -webkit-user-select: text;
}

.tsumo-search-field input:focus {
  border-color: #3977d9;
  box-shadow: 0 0 0 3px #3977d933;
}

.tsumo-search-status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tsumo-search-candidates {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tsumo-search-candidate {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 8px 12px;
  color: var(--ink);
  text-align: left;
  background: #f4f6fa;
  border: 2px solid #d8dfeb;
  border-radius: 12px;
}

.tsumo-search-candidate:hover,
.tsumo-search-candidate[aria-selected="true"] {
  background: #eaf2ff;
  border-color: #3977d9;
}

.tsumo-search-candidate:focus-visible {
  outline: 3px solid #3977d9;
  outline-offset: 2px;
}

.tsumo-search-number {
  flex: 0 0 auto;
  min-width: 66px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.tsumo-search-sequence {
  display: flex;
  gap: 4px;
  min-width: 0;
}

.tsumo-search-puyo {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  box-shadow: inset -2px -2px 0 #0002, inset 2px 2px 0 #fff5;
}

.tsumo-search-puyo.red { background: var(--red); }
.tsumo-search-puyo.green { background: var(--green); }
.tsumo-search-puyo.blue { background: var(--blue); }
.tsumo-search-puyo.yellow { background: var(--yellow); }
.tsumo-search-puyo.purple { background: var(--purple); }

.tsumo-search-confirm {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
}

@media (max-width: 480px) {
  .tsumo-search-candidate {
    gap: 8px;
    padding-inline: 10px;
  }

  .tsumo-search-sequence {
    gap: 2px;
  }

  .tsumo-search-puyo {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }
}

@media (max-width: 400px) {
  .tsumo-search-candidate {
    gap: 6px;
    padding-inline: 8px;
  }

  .tsumo-search-number {
    min-width: 56px;
    font-size: 11px;
  }

  .tsumo-search-sequence {
    gap: 1px;
  }

  .tsumo-search-puyo {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }
}

.custom-tokopuyo-card {
  position: relative;
  width: min(100%, 460px);
  max-height: calc(100svh - 32px);
  padding: 28px 20px 20px;
  overflow-y: auto;
  color: var(--ink);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 18px 50px #10182766;
  overscroll-behavior: contain;
}

.custom-tokopuyo-card h2 {
  margin: 0 40px 8px 0;
  font-size: 21px;
  line-height: 1.25;
}

.custom-tokopuyo-card h3,
.custom-tokopuyo-card h4 {
  margin: 0;
  color: var(--ink);
}

.custom-tokopuyo-card h3 {
  font-size: 15px;
}

.custom-tokopuyo-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.custom-tokopuyo-intro {
  margin-bottom: 18px !important;
}

.custom-palette-section,
.custom-opening-section,
.custom-row14-section {
  padding: 15px 0;
  border-top: 1px solid #e2e7f0;
}

.custom-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.custom-palette-locked {
  color: #8a6472;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  text-align: right;
}

.custom-palette-options {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  margin-top: 12px;
}

.custom-palette-option {
  display: grid;
  width: clamp(40px, 12vw, 52px);
  height: clamp(40px, 12vw, 52px);
  min-width: 0;
  padding: 0;
  place-items: center;
  background: #f4f6fa;
  border: 2px solid #d9dfeb;
  border-radius: 12px;
}

.custom-palette-option[aria-pressed="true"],
.custom-palette-option.active {
  background: #eef5ff;
  border-color: #3977d9;
  box-shadow: 0 0 0 2px #3977d922;
}

.custom-palette-option:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.custom-palette-dots {
  display: grid;
  grid-template-columns: repeat(2, 10px);
  gap: 3px;
}

.custom-palette-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset -1px -1px #0002, inset 1px 1px #fff5;
}

.custom-palette-dots .red { background: var(--red); }
.custom-palette-dots .green { background: var(--green); }
.custom-palette-dots .blue { background: var(--blue); }
.custom-palette-dots .yellow { background: var(--yellow); }
.custom-palette-dots .purple { background: var(--purple); }

.custom-opening-pairs {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 5vw, 24px);
  margin-top: 12px;
}

.custom-opening-pair {
  min-width: 0;
  text-align: center;
}

.custom-opening-pair h4 {
  margin-bottom: 7px;
  color: #5e687d;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.custom-opening-cells {
  display: grid;
  gap: 3px;
}

.custom-opening-cell {
  width: clamp(42px, 13vw, 58px);
  height: clamp(42px, 13vw, 58px);
  padding: 0;
  background: #edf1f7;
  border: 2px solid #d4dce8;
  border-radius: 50%;
  box-shadow: inset -4px -5px 0 #0000001c, inset 3px 3px 0 #ffffff38,
    0 2px 3px #10182755;
  touch-action: none;
}

.custom-opening-cell[data-color="red"] { background: var(--red); }
.custom-opening-cell[data-color="green"] { background: var(--green); }
.custom-opening-cell[data-color="blue"] { background: var(--blue); }
.custom-opening-cell[data-color="yellow"] { background: var(--yellow); }
.custom-opening-cell[data-color="purple"] { background: var(--purple); }

.custom-opening-cell:focus-visible,
.custom-palette-option:focus-visible,
.row14-toggle:focus-visible,
.custom-tokopuyo-confirm:focus-visible {
  outline: 3px solid #3977d9;
  outline-offset: 2px;
}

.custom-row14-toggles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin-top: 12px;
}

.row14-toggle {
  aspect-ratio: 1;
  min-height: 36px;
  padding: 0;
  color: #69738a;
  font-size: 12px;
  font-weight: 800;
  background: #f0f3f8;
  border: 2px solid #d8dfeb;
  border-radius: 9px;
}

.row14-toggle[aria-pressed="true"] {
  color: #fff;
  background: #667288;
  border-color: #505b6e;
  box-shadow: inset 0 -2px #0002, inset 0 2px #fff2;
}

.custom-tokopuyo-confirm {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}

.help-overlay[hidden] {
  display: none;
}

.review-overlay {
  position: fixed;
  z-index: 31;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: #10182799;
  overscroll-behavior: contain;
}

.review-overlay[hidden] {
  display: none;
}

.review-card {
  position: relative;
  width: min(100%, 540px);
  max-height: calc(100svh - 32px);
  padding: 24px;
  overflow-y: auto;
  color: var(--ink);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 18px 50px #10182766;
}

.review-eyebrow {
  margin: 0 0 3px;
  color: #69738a;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-card h2 {
  margin: 0 40px 8px 0;
  font-size: 23px;
}

.review-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.review-summary {
  font-size: 15px;
  font-weight: 800;
}

.review-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 10px 0 0;
}

.review-stat {
  min-width: 0;
  padding: 9px 5px;
  text-align: center;
  background: #f1f4f9;
  border-radius: 11px;
}

.review-stat strong,
.review-stat small {
  display: block;
}

.review-stat strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-stat small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.review-stat-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 22px;
  margin-top: 2px;
}

.review-stat-label .review-help > summary {
  width: 18px;
  height: 18px;
  font-size: 10px;
}

.review-stats.review-ranking-stat {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 7px;
}

.review-ranking-stat .review-stat-inline {
  gap: 5px;
  padding: 8px;
}

.review-ranking-stat .review-stat-label { gap: 3px; }

.review-stat-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 20px;
}

.review-stat-inline .review-stat-label {
  min-height: 0;
  margin: 0;
}

.review-stat-inline strong {
  flex: 0 0 auto;
  min-width: 4ch;
  text-align: right;
}

.review-stat:first-child .review-help-body {
  right: auto;
  left: 0;
}

.review-stat:nth-child(2) .review-help-body {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}

.review-stat:last-child .review-help-body {
  right: 0;
  left: auto;
}

.review-ranking-stat .review-stat:nth-child(2) .review-help-body {
  right: -52px;
  left: auto;
  transform: none;
}

.review-ranking-chart {
  margin: 9px 0 0;
  padding: 9px 10px 7px;
  background: #f7f8fb;
  border: 1px solid #dfe4ec;
  border-radius: 12px;
}

.review-ranking-chart[hidden] { display: none; }

.review-ranking-chart figcaption {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.review-ranking-plot {
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr);
  gap: 5px;
  margin-top: 9px;
  padding-top: 16px;
}

.review-ranking-y-axis {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-left: 13px;
  color: var(--muted);
  font-size: 7px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1;
  text-align: right;
}

.review-ranking-y-axis > span {
  position: relative;
}

.review-ranking-y-axis > span::after {
  position: absolute;
  top: 50%;
  right: -5px;
  width: 3px;
  border-top: 1px solid #cfd6e1;
  content: "";
}

.review-ranking-bars {
  display: grid;
  grid-template-columns: repeat(var(--ranking-count), minmax(2px, 1fr));
  align-items: end;
  gap: 2px;
  height: 96px;
  padding: 0 1px;
  border-bottom: 1px solid #dfe4ec;
  background: linear-gradient(
    to bottom,
    #dfe4ec 0,
    #dfe4ec 1px,
    transparent 1px,
    transparent 49.5%,
    #dfe4ec 49.5%,
    #dfe4ec 50.5%,
    transparent 50.5%,
    transparent calc(100% - 1px),
    #dfe4ec calc(100% - 1px)
  );
}

.review-ranking-bar {
  position: relative;
  min-width: 0;
  min-height: 2px;
  height: var(--bar-height);
  background: #a674ed;
  border-radius: 3px 3px 0 0;
}

.review-ranking-bar.user { background: #4e8df7; }

.review-ranking-bar.user::before {
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  color: #315b9c;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  content: "YOU";
  transform: translateX(-50%);
}

.review-ranking-axis {
  display: flex;
  justify-content: space-between;
  margin: 3px 0 0 48px;
  color: var(--muted);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.review-ranges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.review-range {
  padding: 9px 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  background: #f5f1fb;
  border-radius: 11px;
}

.review-range strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 13px;
}

.review-branch-section {
  margin-top: 17px;
}

.review-branch-section[hidden] {
  display: none;
}

.review-branch-section h3,
.review-evaluation-section h3 {
  margin: 0;
  font-size: 14px;
}

.review-section-heading,
.review-metric-heading,
.review-contribution-heading,
.review-contribution-label {
  display: flex;
  align-items: center;
}

.review-section-heading,
.review-metric-heading,
.review-contribution-heading {
  justify-content: space-between;
  gap: 8px;
}

.review-help {
  position: relative;
  flex: 0 0 auto;
}

.review-help > summary {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  color: #315b9c;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  background: #eef5ff;
  border-radius: 50%;
  place-items: center;
  list-style: none;
}

.review-help > summary::-webkit-details-marker { display: none; }

.review-help > p,
.review-help-body {
  position: absolute;
  z-index: 6;
  top: 27px;
  right: 0;
  width: min(250px, calc(100vw - 70px));
  margin: 0;
  padding: 10px 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.45;
  background: #fff;
  border: 1px solid #d9e0ea;
  border-radius: 10px;
  box-shadow: 0 8px 24px #17233a22;
}

.review-help-body p { margin: 0; }

.review-contribution-label .review-help > p,
.review-contribution-label .review-help-body,
.review-signal-row .review-help > p,
.review-signal-row .review-help-body {
  right: auto;
  left: 0;
}

.review-legend-user,
.review-branch-fill.user {
  background: #4e8df7;
}

.review-legend-ama,
.review-branch-fill.ama {
  background: #a674ed;
}

.review-branch-chart {
  display: grid;
  gap: 7px;
}

.review-branch-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 7px;
}

.review-future-pairing,
.review-pair-group {
  display: flex;
  align-items: center;
}

.review-future-pairing {
  justify-content: center;
  gap: 4px;
}

.review-pair-group { gap: 2px; }

.review-placement-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  min-height: 18px;
  gap: 3px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.review-placement-label .review-color-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
}

.review-placement-label .review-placement-separator {
  margin-right: 1px;
}

.review-placement-label .review-color-dot + span:not(.review-placement-separator) {
  margin-right: 4px;
}

.review-color-dot {
  width: 12px;
  height: 12px;
  border: 1px solid #17233a22;
  border-radius: 50%;
  box-shadow: inset -1px -1px #0002, inset 1px 1px #fff5;
}

.review-pair-separator {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
}

.review-branch-bars {
  display: grid;
  gap: 3px;
}

.review-branch-line {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.review-branch-line small,
.review-branch-line .review-branch-value {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.review-branch-line .review-branch-value {
  text-align: right;
}

.review-branch-track {
  height: 7px;
  overflow: hidden;
  background: #e5e9f1;
  border-radius: 999px;
}

.review-branch-fill {
  display: block;
  width: var(--branch-width);
  min-width: 0;
  height: 100%;
  border-radius: inherit;
}

.review-section-summary {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.review-future-metrics {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.review-future-metrics > article,
.review-priority-chart > article {
  padding: 9px 10px;
  background: #f5f1fb;
  border-radius: 10px;
}

.review-metric-heading {
  margin-bottom: 6px;
}

.review-metric-heading > strong { font-size: 11px; }

.review-metric-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.review-metric-row small,
.review-metric-value {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.review-metric-row.is-better .review-metric-value { color: var(--ink); }
.review-metric-value { text-align: right; }

.review-metric-track {
  height: 8px;
  overflow: hidden;
  background: #dfe4ec;
  border-radius: 999px;
}

.review-metric-fill {
  display: block;
  width: var(--metric-width);
  height: 100%;
  border-radius: inherit;
}

.review-metric-fill.user { background: #4e8df7; }
.review-metric-fill.ama { background: #a674ed; }

.review-future-details {
  margin-top: 8px;
  border-top: 1px solid #e5e9f1;
}

.review-future-details > summary {
  padding: 9px 0 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.review-evaluation-section {
  margin-top: 18px;
}

.review-evaluation-section[hidden] {
  display: none;
}

.review-evaluation-section h3 {
  margin: 0;
  font-size: 14px;
}

.review-insight-cards {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.review-insight-cards article {
  padding: 10px 11px;
  background: #eef5ff;
  border-radius: 11px;
}

.review-insight-cards strong {
  font-size: 11px;
}

.review-insight-cards p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.review-signal-details {
  margin-top: 9px;
  border: 1px solid #dfe4ec;
  border-radius: 11px;
}

.review-signal-details > summary {
  padding: 10px 11px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.review-signal-table {
  padding: 0 9px 9px;
}

.review-signal-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.5fr) repeat(2, minmax(62px, 0.7fr));
  gap: 7px;
  align-items: center;
  padding: 7px 2px;
  border-top: 1px solid #edf0f5;
  font-size: 9px;
}

.review-signal-row > span:first-child strong,
.review-signal-row > span:first-child .review-help {
  display: inline-block;
}

.review-show-evidence {
  min-height: 24px;
  margin-top: 5px;
  padding: 3px 7px;
  color: #315b9c;
  font: inherit;
  font-weight: 800;
  background: #eef5ff;
  border: 0;
  border-radius: 7px;
}

.review-signal-row > span:first-child {
  display: flex;
  align-items: center;
  gap: 5px;
}

.review-signal-row > span:not(:first-child) {
  text-align: right;
  font-weight: 800;
}

.review-signal-header {
  color: var(--muted);
  font-weight: 800;
}

.review-priority-chart { margin-top: 9px; }

.review-contribution-chart {
  padding: 10px;
  margin-top: 9px;
  background: #f7f8fb;
  border-radius: 11px;
}

.review-contribution-heading { margin-bottom: 8px; }
.review-contribution-heading > strong { font-size: 11px; }

.review-contribution-heading > span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.review-contribution-heading i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.review-contribution-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.8fr) minmax(90px, 1.2fr) 36px;
  align-items: center;
  gap: 6px;
  min-height: 29px;
}

.review-contribution-label {
  gap: 4px;
  min-width: 0;
}

.review-contribution-label > strong {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-contribution-label .review-help > summary {
  width: 18px;
  height: 18px;
  font-size: 10px;
}

.review-contribution-track {
  position: relative;
  height: 8px;
  background: linear-gradient(to right, #e5e9f1 49%, #aeb8c8 49%, #aeb8c8 51%, #e5e9f1 51%);
  border-radius: 999px;
}

.review-contribution-fill {
  position: absolute;
  width: var(--edge-width);
  height: 100%;
}

.review-contribution-fill.user {
  right: 50%;
  background: #4e8df7;
  border-radius: 999px 0 0 999px;
}

.review-contribution-fill.ama {
  left: 50%;
  background: #a674ed;
  border-radius: 0 999px 999px 0;
}

.review-contribution-value {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-align: right;
}

.review-mini-puyo.review-evidence {
  opacity: 0.62;
  border: 2px dashed #17233a;
  box-shadow: none;
}

.review-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 17px;
}

.review-comparison section {
  min-width: 0;
}

.review-comparison h3 {
  margin: 0 0 2px;
  font-size: 14px;
}

.review-board-state {
  min-height: 16px;
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.review-board-state:empty { display: none; }

.review-mini-board {
  display: grid;
  grid-template-rows: repeat(14, minmax(0, 1fr));
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: min(100%, 150px);
  aspect-ratio: 6 / 14;
  margin: 6px auto 0;
  padding: 4px;
  gap: 1px;
  background: var(--board);
  border-radius: 9px;
}

.review-mini-cell {
  position: relative;
  min-width: 0;
  background: #394762;
  border-radius: 2px;
}

.review-mini-cell.review-row14,
.review-mini-cell.review-hidden {
  background: #303b55;
}

.review-mini-cell.review-row14 {
  border-bottom: 1px dashed #93a0bc88;
}

.review-mini-puyo {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  box-shadow: inset -2px -2px #0002, inset 2px 2px #fff5;
}

.review-mini-puyo.review-row14-occupied {
  background: #8c96a8;
}

.review-mini-puyo.review-placement {
  outline: 2px solid #fff;
  outline-offset: -1px;
}

.review-replay-launch {
  display: block;
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  color: #315b9c;
  font: inherit;
  font-size: 10px;
  font-weight: 900;
  background: #eef5ff;
  border: 0;
  border-radius: 9px;
}

.review-replay-launch:disabled {
  color: #9aa4b5;
  background: #f1f3f6;
}

.review-ranking-section { margin-top: 17px; }

.review-ranking-section[hidden],
.review-ranking-preview[hidden] { display: none; }

.review-ranking-section h3 { margin: 0; font-size: 15px; }

.review-ranking-table-wrap {
  margin-top: 7px;
  overflow-x: auto;
  border: 1px solid #dfe4ec;
  border-radius: 12px;
}

.review-ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.review-ranking-table th,
.review-ranking-table td {
  padding: 7px 6px;
  border-bottom: 1px solid #e7eaf0;
  text-align: left;
  vertical-align: middle;
}

.review-ranking-table thead th {
  color: #69738a;
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f7f8fb;
}

.review-ranking-table tr:last-child > * { border-bottom: 0; }
.review-ranking-table th:first-child { width: 32px; text-align: center; }

.review-ranking-table th:last-child,
.review-ranking-table td:last-child {
  width: 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.review-ranking-move {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.review-ranking-move button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 8px;
  color: #315b9c;
  font: inherit;
  font-size: 9px;
  font-weight: 900;
  background: #eef5ff;
  border: 0;
  border-radius: 8px;
}

.review-ranking-move button[aria-pressed="true"] {
  color: #fff;
  background: #315b9c;
}

.review-ranking-preview {
  margin-top: 9px;
  padding: 13px;
  background: #f7f8fb;
  border: 1px solid #dfe4ec;
  border-radius: 14px;
}

.review-ranking-preview .review-mini-board { width: 150px; }

.review-replay-panel {
  margin-top: 17px;
  padding: 13px;
  background: #f7f8fb;
  border: 1px solid #dfe4ec;
  border-radius: 14px;
}

.review-replay-panel[hidden] { display: none; }
.review-replay-panel h3 { margin: 1px 0 0; font-size: 15px; }

.review-replay-source {
  margin: 0;
  color: #69738a;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.review-replay-close {
  width: 30px;
  height: 30px;
  color: var(--muted);
  font-size: 18px;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.review-replay-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 28px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 9px;
}

.review-replay-meta strong { color: var(--ink); font-size: 11px; }

.review-replay-stage {
  display: grid;
  grid-template-columns: 42px minmax(0, 150px);
  justify-content: center;
  align-items: start;
  gap: 9px;
}

.review-replay-board { width: 150px; margin: 0; }

.review-replay-pair {
  display: grid;
  gap: 2px;
  min-height: 58px;
  padding: 5px;
  background: #303b55;
  border-radius: 9px;
}

.review-replay-puyo {
  width: 25px;
  height: 25px;
  margin: auto;
  border-radius: 50%;
  box-shadow: inset -2px -2px #0002, inset 2px 2px #fff5;
}

.review-replay-status {
  min-height: 18px;
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.review-replay-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.review-replay-controls button {
  min-height: 36px;
  color: #315b9c;
  font: inherit;
  font-size: 10px;
  font-weight: 900;
  background: #e7f0ff;
  border: 0;
  border-radius: 9px;
}

.review-replay-controls button:disabled {
  color: #9aa4b5;
  background: #eceff3;
}

.review-mini-cell.review-choke::after {
  position: absolute;
  z-index: 2;
  display: grid;
  inset: 0;
  place-items: center;
  content: "×";
  color: #ff9a9a;
  font-size: 8px;
  font-weight: 900;
}

.help-card {
  position: relative;
  width: min(100%, 390px);
  max-height: calc(100svh - 40px);
  overflow-y: auto;
  padding: 28px 24px 24px;
  color: var(--ink);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 18px 50px #10182755;
}

.help-card h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.language-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.language-picker select {
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  font: inherit;
  background: #f1f4f9;
  border: 1px solid #d5dce8;
  border-radius: 9px;
}

.help-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.help-card ul {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.help-card h3 {
  margin: 20px 0 8px;
  font-size: 15px;
}

.help-gesture-note { margin-top: 14px !important; }

.help-controls-table {
  --sidebar-size: clamp(44px, 12vw, 58px);

  width: 100%;
  margin: 0;
  border-spacing: 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.help-controls-table td:first-child {
  width: 68px;
  padding-right: 10px;
  vertical-align: middle;
}

.help-control-preview {
  pointer-events: none;
  cursor: default;
}

.desktop-shortcut {
  font-weight: 700;
  white-space: nowrap;
}

.help-control-source.toolbar,
.help-control-source.left-sidebar {
  display: block;
  width: auto;
  height: auto;
  min-height: 0;
  flex: none;
  padding: 0;
}

.help-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  background: transparent;
  border: 0;
}

.help-flick-demo {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 18px auto 6px;
  background: #172033d9;
  border-radius: 50%;
}

.help-flick-option {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-60px)
    rotate(calc(-1 * var(--angle)));
}

.help-flick-option:nth-child(1) { --angle: 0deg; }
.help-flick-option:nth-child(2) { --angle: 60deg; }
.help-flick-option:nth-child(3) { --angle: 120deg; }
.help-flick-option:nth-child(4) { --angle: 180deg; }
.help-flick-option:nth-child(5) { --angle: 240deg; }
.help-flick-option:nth-child(6) { --angle: 300deg; }

.help-flick-option i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.help-flick-option.red i { background: var(--red); }
.help-flick-option.green i { background: var(--green); }
.help-flick-option.blue i { background: var(--blue); }
.help-flick-option.yellow i { background: var(--yellow); }
.help-flick-option.purple i { background: var(--purple); }
.help-flick-option.garbage i {
  background: #8c96a8;
}

.help-flick-delete {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #59657b;
  font-size: 21px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

@keyframes pop {
  from { opacity: 0.2; transform: scale(0.55); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes vanish {
  to { opacity: 0; transform: scale(1.35); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes ignition-pulse {
  to {
    filter: drop-shadow(0 0 8px currentColor);
    transform: scale(1.08);
  }
}

@media (max-width: 599px) {
  .desktop-shortcut { display: none; }

  .app-shell {
    padding: max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }
  .play-area { gap: 4px; }
  .board-card {
    padding: 16px 10px;
    overflow: hidden;
  }
  .board-wrap {
    width: min(100%, calc(46.153svh - 10.923px));
    max-height: none;
    padding: 7px;
  }
  .left-sidebar { gap: 7px; padding-top: 2px; }
  .toolbar { gap: 7px; padding-top: 2px; }
  .tokopuyo-controls {
    min-height: 74px;
    margin: 4px max(-8px, env(safe-area-inset-right)) max(-8px, env(safe-area-inset-bottom)) max(-8px, env(safe-area-inset-left));
  }
  .pair-movement-controls,
  .pair-action-controls { gap: 6px; }
  .toolbar .primary-btn,
  .toolbar .reset-btn,
  .sidebar-btn,
  .help-btn { border-radius: 12px; }
  .toolbar .simulation-row,
  .sidebar-actions { gap: 7px; }
  .sidebar-btn { font-size: 21px; }
  .review-card { padding: 20px 16px; }
  .review-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .review-comparison { gap: 10px; }
  .review-mini-board { width: min(100%, 130px); }
}
