/*! supertwentyplus licence: (c) 2026 Supertwentyplus Pte. Ltd. All rights reserved. Proprietary, not open source.
   Use only as provided on supertwentyplus.com (free or by subscription, under its Terms). Copying, reuse or hosting elsewhere,
   in whole or in part, needs a written licence: supertwentyplus@gmail.com. See LICENSE.txt at the site root. */
/* Magic Cube */
.mc-app { gap: 10px; }
.mc-stage {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  margin: calc(clamp(18px, 3vw, 28px) * -1) calc(clamp(18px, 3vw, 28px) * -1) 0;
  padding: 10px;
  border-radius: var(--widget-radius) var(--widget-radius) 3px 3px;
  background:
    radial-gradient(90% 60% at 0% 0%, rgba(255, 61, 139, .32), transparent 60%),
    radial-gradient(90% 60% at 100% 0%, rgba(255, 214, 10, .22), transparent 60%),
    radial-gradient(110% 70% at 50% 100%, rgba(30, 107, 255, .35), transparent 60%),
    linear-gradient(160deg, #1d0f45, #0f0a2a 60%, #081634);
  color: #fff; -webkit-tap-highlight-color: transparent;
  font-size: 13px;
}
.mc-stage.mc-fs { position: fixed; inset: 0; z-index: 1000; margin: 0; border-radius: 0; overflow: auto; }
.mc-stage:fullscreen { margin: 0; border-radius: 0; overflow: auto; }
html.mc-noscroll { overflow: hidden; }

/* HUD */
.mc-hud { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.mc-tabs { display: flex; gap: 2px; padding: 2px; border-radius: 4px; background: rgba(255, 255, 255, .1); }
.mc-tabs button {
  height: 28px; padding: 0 10px; border: 0; border-radius: 3px; cursor: pointer;
  background: transparent; color: #fff; font: 400 15px/1 'Lilita One', var(--font-display); letter-spacing: .03em;
}
.mc-tabs button[aria-selected="true"] { background: linear-gradient(135deg, #ff3d8b, #ff7a00); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.mc-stat { display: flex; align-items: baseline; gap: 5px; justify-content: flex-end; line-height: 1; }
.mc-k { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.mc-stat strong { font: 400 19px/1 'Lilita One', var(--font-display); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }

/* Cube and side column */
.mc-main { display: flex; flex-direction: column; gap: 8px; }
.mc-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mc-view { position: relative; width: 100%; aspect-ratio: 1 / .92; max-height: 58vh; margin: 0 auto; touch-action: none; }
.mc-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.mc-canvas:active { cursor: grabbing; }
.mc-nogl { padding: 40px 16px; text-align: center; }
.mc-stage.mc-fs .mc-view, .mc-stage:fullscreen .mc-view { max-height: 64vh; }

.mc-hint { order: 1; } .mc-pad { order: 2; } .mc-tools { order: 3; } .mc-lesson { order: 4; }
.mc-learning .mc-view { max-height: 44vh; }
.mc-msg { margin: 0; min-height: 18px; font-size: 13px; line-height: 1.35; font-weight: 600; color: #ffe98a; }
.mc-msg.mc-pop { animation: mc-pop .4s ease-out; }
@keyframes mc-pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* Move pad */
.mc-pad { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.mc-mv {
  --mc: #8d5bff; height: 30px; padding: 0; border: 0; border-radius: 3px; cursor: pointer;
  background: var(--mc); color: #14101f; font: 400 15px/1 'Lilita One', var(--font-display);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25);
}
.mc-mv.mc-dark { color: #fff; background: color-mix(in srgb, var(--mc) 62%, #000) !important; }
.mc-mv:nth-child(n+13) { --mc: #6d3cff; color: #fff; }
.mc-mv:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); }

/* Buttons */
.mc-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
.mc-btn {
  height: 30px; padding: 0 8px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 3px; cursor: pointer;
  background: rgba(255, 255, 255, .1); color: #fff; font: 700 12px/1 var(--font-body, system-ui), sans-serif; white-space: nowrap;
}
.mc-btn:hover { background: rgba(255, 255, 255, .18); }
.mc-btn:disabled { opacity: .45; cursor: default; }
.mc-btn.mc-hot { border-color: transparent; background: linear-gradient(135deg, #ffd60a, #ff7a00); color: #1b1030; }

/* Hint and chips */
.mc-hint, .mc-lesson {
  --lc: #ff7a00; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px;
  border-radius: 3px; border-left: 4px solid var(--lc); background: rgba(255, 255, 255, .08);
}
.mc-hint[hidden], .mc-lesson[hidden] { display: none; }
.mc-hhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mc-hstep { --lc: #ff7a00; font: 400 15px/1.1 'Lilita One', var(--font-display); color: var(--lc); }
.mc-x { width: 26px; height: 26px; border: 0; border-radius: 3px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; }
.mc-htext { margin: 0; line-height: 1.4; }
.mc-hint .mc-btn { align-self: flex-start; }
.mc-chips, .mc-amoves { display: flex; flex-wrap: wrap; gap: 3px; }
.mc-chip {
  min-width: 26px; height: 22px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 3px;
  background: #fff; color: #1b1030; font: 700 13px/1 ui-monospace, Menlo, Consolas, monospace; transition: background .15s, transform .15s;
}
.mc-chip.on { background: #ffd60a; transform: translateY(-2px); box-shadow: 0 2px 0 #ff7a00; }
.mc-chip.done { opacity: .45; }

/* Lessons */
.mc-lnav { display: flex; align-items: center; gap: 4px; }
.mc-lbtn { width: 28px; height: 26px; flex: none; border: 0; border-radius: 3px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.mc-lbtn:disabled { opacity: .3; cursor: default; }
.mc-dots { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; flex: 1; }
.mc-dot {
  --lc: #fff; height: 26px; padding: 0; border: 0; border-radius: 3px; cursor: pointer;
  background: color-mix(in srgb, var(--lc) 35%, transparent); color: #fff; font: 400 14px/1 'Lilita One', var(--font-display);
}
.mc-dot.on { background: var(--lc); color: #14101f; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.mc-ltitle { margin: 2px 0 0; font: 400 19px/1.1 'Lilita One', var(--font-display); color: var(--lc); letter-spacing: .01em; }
.mc-lbody p { margin: 0 0 6px; line-height: 1.45; }
.mc-lbody p:last-child { margin: 0; }
.mc-lbody b { color: #fff; }
.mc-algs { display: flex; flex-direction: column; gap: 3px; }
.mc-alg {
  display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 3px 6px; border: 0; border-radius: 3px; cursor: pointer; text-align: left;
  background: rgba(0, 0, 0, .28); color: #fff; font: inherit;
}
.mc-alg:hover { background: rgba(0, 0, 0, .4); }
.mc-aname { flex: none; min-width: 78px; font-weight: 700; font-size: 12px; color: var(--lc); }
.mc-lact { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.mc-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; }
.mc-check[hidden] { display: none; }
.mc-check input { width: 15px; height: 15px; margin: 0; accent-color: #ff3d8b; }

/* Win */
.mc-win { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; overflow: hidden; background: rgba(10, 6, 30, .35); }
.mc-win[hidden] { display: none; }
.mc-wincard {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 20px;
  border-radius: 3px; background: #1b1030; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); animation: mc-pop .4s ease-out;
}
.mc-wincard strong {
  font: 400 40px/1 'Lilita One', var(--font-display);
  background: linear-gradient(90deg, #ffd60a, #ff7a00, #ff3d8b, #8d5bff, #1e6bff, #00c853); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.mc-wincard span { font-weight: 700; }
.mc-wincard em { font-style: normal; color: #ffd60a; font-weight: 700; }
.mc-conf i {
  position: absolute; top: -12px; left: var(--x); width: 8px; height: 12px; border-radius: 2px; background: var(--c);
  animation: mc-fall 2.4s var(--d) ease-in forwards; transform: rotate(var(--r));
}
@keyframes mc-fall { to { transform: translateY(110vh) rotate(calc(var(--r) + 540deg)); } }

/* Options below the stage */
.mc-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.mc-lab { font-weight: 700; font-size: 12px; }
.mc-opts .seg button { min-height: 28px; padding: 0 10px; font-size: 12px; }
.mc-opts .mc-check input { accent-color: var(--accent, #6d3cff); }
.mc-more summary { cursor: pointer; font-weight: 700; font-size: 13px; padding: 4px 0; }
.mc-table { display: flex; flex-direction: column; }
.mc-row { display: flex; justify-content: space-between; gap: 10px; min-height: 26px; align-items: center; font-size: 13px; border-bottom: 1px solid var(--line, rgba(0, 0, 0, .1)); }
.mc-row.mc-sub { color: var(--muted, #666); font-size: 12px; }
.mc-link { margin-top: 6px; padding: 0; border: 0; background: none; color: var(--muted, #666); font-size: 12px; text-decoration: underline; cursor: pointer; }

/* Wider screens: cube left, controls right */
@media (min-width: 760px) {
  .mc-stage { padding: 12px 14px 14px; }
  .mc-main { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(260px, 1fr); align-items: start; gap: 14px; }
  .mc-view { aspect-ratio: 1; max-height: 74vh; }
  .mc-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mc-lesson { order: 1; } .mc-hint { order: 4; }
  .mc-learning .mc-view { max-height: 74vh; }
}
@media (max-width: 380px) {
  .mc-tabs button { padding: 0 10px; }
  .mc-stat strong { font-size: 17px; }
}

/* Learn mode has no timer */
.mc-learning .mc-stat-time { display: none; }

/* Full screen on wide screens: one centred column, like the phone layout */
@media (min-width: 760px) {
  .mc-stage.mc-fs, .mc-stage:fullscreen { align-items: center; padding: 14px 16px; }
  .mc-fs .mc-hud, .mc-stage:fullscreen .mc-hud,
  .mc-fs .mc-main, .mc-stage:fullscreen .mc-main { width: min(560px, 100%); }
  .mc-fs .mc-main, .mc-stage:fullscreen .mc-main { display: flex; flex-direction: column; gap: 8px; margin: 0 auto; }
  .mc-fs .mc-view, .mc-stage:fullscreen .mc-view { width: 100%; aspect-ratio: 1 / .92; max-height: 56vh; }
  .mc-fs.mc-learning .mc-view, .mc-stage.mc-learning:fullscreen .mc-view { max-height: 44vh; }
  .mc-fs .mc-msg, .mc-stage:fullscreen .mc-msg { text-align: center; }
  .mc-fs .mc-hint, .mc-stage:fullscreen .mc-hint { order: 1; }
  .mc-fs .mc-lesson, .mc-stage:fullscreen .mc-lesson { order: 4; }
}

/* Lesson legend with many moves: two columns */
.mc-algs.mc-algs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mc-algs-grid .mc-aname { min-width: 0; flex: 1; }

/* Full-screen legend beside the cube (wide screens only) */
.mc-legend { display: none; }
@media (min-width: 1100px) {
  .mc-fs .mc-legend, .mc-stage:fullscreen .mc-legend {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; align-content: start;
    position: absolute; top: 50%; right: max(16px, calc(50% - 280px - 380px)); width: 340px; transform: translateY(-50%);
    padding: 8px; border-radius: 3px; background: rgba(255, 255, 255, .08);
  }
  .mc-legend h3 { grid-column: 1 / -1; margin: 0 0 2px; font: 400 16px/1.1 'Lilita One', var(--font-display); color: #ffd60a; }
  .mc-lrow {
    display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; border: 0; border-radius: 3px; cursor: pointer;
    background: rgba(0, 0, 0, .28); color: #fff; font: 600 12px/1 var(--font-body, system-ui), sans-serif; text-align: left;
  }
  .mc-lrow:hover { background: rgba(0, 0, 0, .45); }
}

/* Compare methods */
.mc-cmp { --lc: #1e6bff; }
.mc-small { margin: 0; font-size: 12px; line-height: 1.4; opacity: .85; }
.mc-clist { display: flex; flex-direction: column; gap: 5px; }
.mc-crow { display: flex; flex-direction: column; gap: 3px; padding: 6px; border-radius: 3px; background: rgba(0, 0, 0, .28); }
.mc-chead { display: flex; align-items: center; gap: 8px; }
.mc-chead b { flex: 1; font-size: 13px; }
.mc-cn { font: 400 16px/1 'Lilita One', var(--font-display); color: #ffd60a; }
.mc-cplay { height: 24px; }
.mc-cbar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.mc-cbar i { display: block; height: 100%; background: var(--c); border-radius: 3px; }
.mc-cparts { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 12px; opacity: .85; }
.mc-cparts b { color: #fff; }
@media (min-width: 760px) { .mc-cmp { order: 1; } }
.mc-fs .mc-cmp, .mc-stage:fullscreen .mc-cmp { order: 4; }

.mc-cwin { padding: 6px 8px; border-radius: 3px; background: linear-gradient(135deg, #ffd60a, #ff7a00); color: #1b1030; font-size: 13px; }
.mc-crow.mc-best { box-shadow: inset 0 0 0 2px #ffd60a; }
.mc-chead em { margin-left: 4px; padding: 1px 5px; border-radius: 3px; background: #ffd60a; color: #1b1030; font-style: normal; font-size: 12px; vertical-align: middle; }
.mc-moves summary { cursor: pointer; font-size: 12px; font-weight: 700; color: #ffd60a; padding: 2px 0; }
.mc-moves[open] { max-height: 260px; overflow: auto; }
.mc-mrow { display: flex; flex-direction: column; gap: 2px; padding: 3px 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.mc-mt { font-size: 12px; opacity: .8; }
.mc-mrow .mc-chip { min-width: 24px; height: 20px; font-size: 12px; }
.mc-chip.mc-rot { background: #c9b8ff; }

/* v2030: phones, keep the HUD inside the screen (was 10px sideways scroll) */
@media (max-width: 480px) {
  .mc-hud { grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; }
  .mc-tabs button { padding: 0 7px; font-size: 14px; }
  .mc-stat { gap: 3px; min-width: 0; }
  .mc-stat strong { font-size: 16px; }
  .mc-stage, .mc-main, .mc-view { max-width: 100%; min-width: 0; }
}
