:root {
  --ink: #2d2532;
  --muted: #766b7d;
  --panel: rgba(255, 255, 255, 0.76);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --line: rgba(70, 54, 82, 0.16);
  --ally: #ff6f9f;
  --ally-deep: #d94c83;
  --ally-soft: #ffd4e3;
  --rival: #6f8cff;
  --rival-deep: #5268d9;
  --rival-soft: #dbe3ff;
  --empty: #faf5f8;
  --wall: #b8adbf;
  --gold: #e8b55b;
  --shadow: 0 22px 60px rgba(62, 45, 77, 0.2);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    radial-gradient(circle at 18% 10%, rgba(255, 135, 180, 0.42), transparent 24rem),
    radial-gradient(circle at 84% 18%, rgba(111, 140, 255, 0.34), transparent 26rem),
    radial-gradient(circle at 58% 95%, rgba(143, 221, 198, 0.36), transparent 28rem),
    linear-gradient(135deg, #fff7fb 0%, #f5f0ff 48%, #eefbf7 100%);
  background-size: 32px 32px, 32px 32px, auto, auto, auto, auto;
}

button,
select {
  font: inherit;
}

.app-shell {
  width: min(1220px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
  display: grid;
  place-items: center;
}

.game-panel {
  width: 100%;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.44)),
    rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.topbar,
.setup,
.score-strip,
.board-wrap,
.controls,
.team-preview {
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.7rem);
  letter-spacing: 0;
}

.match-clock {
  min-width: 92px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: var(--panel-strong);
  box-shadow: 0 10px 28px rgba(65, 45, 78, 0.12);
}

.match-clock span {
  display: block;
  font-size: 2.05rem;
  font-weight: 900;
  line-height: 1;
}

.match-clock small,
.mini-label,
.side-label,
.controls {
  color: var(--muted);
  font-size: 0.78rem;
}

.team-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.portrait-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  position: relative;
}

.portrait-card::after {
  content: "";
  position: absolute;
  inset: auto -20px -38px auto;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  opacity: 0.16;
}

.ally-theme::after {
  background: var(--ally);
}

.rival-theme::after {
  background: var(--rival);
}

.portrait-stack {
  position: relative;
  width: 98px;
  height: 60px;
  display: flex;
  align-items: center;
}

.portrait {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 900;
  border: 3px solid #ffffff;
  background: linear-gradient(135deg, var(--ally), var(--gold));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  position: relative;
  flex-shrink: 0;
  z-index: 1;
}

.portrait.rival-avatar {
  background: linear-gradient(135deg, var(--rival), #9f76ff);
}

.portrait.small {
  position: relative;
  right: auto;
  bottom: auto;
  margin-left: -20px;
  width: 56px;
  height: 56px;
  font-size: 1.2rem;
  z-index: 2;
}

.portrait {
  position: relative;
}

.portrait img,
.unit img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}

.portrait-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.08rem;
}

.portrait-card span:not(.side-label) {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.9rem;
}

.setup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
}

.selector-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
}

.start-button,
.skill-button {
  min-height: 82px;
  display: grid;
  place-content: center;
  gap: 3px;
  background: linear-gradient(135deg, #FF6F9F, #E8B55B);
  color: #fff;
  border: none;
  border-radius: 16px;
  box-shadow: 0 10px 20px rgba(255, 111, 159, 0.3);
  font-size: 1.1rem;
  transition: transform 0.1s, box-shadow 0.1s;
  cursor: pointer;
}
.skill-button:active:not(:disabled) {
  transform: scale(0.96);
  box-shadow: 0 4px 10px rgba(255, 111, 159, 0.3);
}

.start-button {
  min-width: 104px;
  padding: 0 22px;
  font-weight: 900;
  background: linear-gradient(135deg, #38263f, #865478);
  box-shadow: 0 14px 28px rgba(95, 62, 93, 0.2);
}

.score-strip {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr minmax(110px, auto);
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.score-block {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.score-block.rival {
  text-align: right;
}

.score-name {
  color: var(--muted);
  font-size: 0.78rem;
}

.score-block strong {
  font-size: 1.45rem;
}

.meter {
  height: 18px;
  display: flex;
  justify-content: space-between;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
}

.meter span {
  width: 50%;
  transition: width 180ms ease;
}

#playerMeter {
  background: linear-gradient(90deg, var(--ally-deep), #ffc0d3);
}

#rivalMeter {
  background: linear-gradient(90deg, #cdd4ff, var(--rival-deep));
}

.board-wrap {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) 292px;
  gap: 16px;
  align-items: start;
}

.board {
  position: relative;
  --cols: 11;
  --rows: 15;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  max-width: 460px;
  aspect-ratio: var(--cols) / var(--rows);
  margin: 0 auto;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(45, 36, 54, 0.14), rgba(255, 255, 255, 0.34)),
    rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 0 0 1px rgba(72, 55, 84, 0.08);
  touch-action: manipulation;
  box-sizing: border-box;
}

.cell {
  position: relative;
  min-width: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 6px;
  background: var(--empty);
  box-shadow: inset 0 0 0 1px rgba(72, 55, 84, 0.08);
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  box-sizing: border-box;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.cell:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(72, 55, 84, 0.16), 0 8px 16px rgba(72, 55, 84, 0.1);
}

.cell.ally {
  background: linear-gradient(135deg, #ffd3e1, #fff0f5);
}

.cell.rival {
  background: linear-gradient(135deg, #dbe3ff, #f1f3ff);
}

.cell.wall {
  cursor: not-allowed;
  background:
    repeating-linear-gradient(45deg, rgba(86, 74, 92, 0.22) 0 6px, rgba(86, 74, 92, 0.08) 6px 12px),
    var(--wall);
}

.cell.target::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 2px solid rgba(45, 37, 50, 0.55);
  border-radius: 999px;
}

.cell.burst {
  transform: scale(0.92);
}

.unit {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  font-size: clamp(0.64rem, 1.4vw, 0.88rem);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 8px rgba(42, 34, 48, 0.25);
  box-sizing: border-box;
}

.unit img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.unit.player,
.unit.support {
  background: linear-gradient(135deg, var(--ally), var(--ally-deep));
}

.unit.enemyA,
.unit.enemyB {
  background: linear-gradient(135deg, var(--rival), var(--rival-deep));
}

.unit.support,
.unit.enemyB {
  width: 90%;
  height: auto;
}

.side-console {
  display: grid;
  gap: 12px;
}

.status-card,
.log-box,
.skill-button {
  border-radius: 8px;
  border: 1px solid var(--line);
}

.status-card,
.log-box {
  padding: 14px;
  background: var(--panel);
}

.return-title-button {
  background: transparent;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
  text-align: center;
}

.return-title-button:hover {
  background: var(--empty);
  color: var(--ink);
}

.status-card strong {
  display: block;
  margin: 3px 0 8px;
  font-size: 1.2rem;
}

.status-card p,
.log-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.skill-button {
  min-height: 82px;
  display: grid;
  place-content: center;
  gap: 3px;
  background: linear-gradient(135deg, #38263f, #b55d83);
  box-shadow: 0 14px 26px rgba(141, 77, 121, 0.2);
}

.skill-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.skill-button span {
  font-weight: 900;
}

.skill-button small {
  color: rgba(255, 255, 255, 0.78);
}

.log-box {
  min-height: 136px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 14px;
  line-height: 1.5;
}

/* utility */
.hidden {
  display: none !important;
}

/* =========================================
   Mode Specific Layout
========================================= */

#boardContainer {
  display: flex;
  flex-direction: column;
}

.enclose-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

.puzzle-ui {
  margin-top: 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

.puzzle-pieces {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
}

.puzzle-piece-container {
  width: 80px;
  height: 80px;
  position: relative;
  border: 1px dashed var(--line);
  border-radius: 4px;
}

.puzzle-piece {
  display: grid;
  gap: 2px;
  cursor: grab;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  user-select: none;
  touch-action: none;
}

.puzzle-piece.dragging {
  cursor: grabbing;
  z-index: 1000;
  opacity: 0.8;
}

.puzzle-block {
  width: 16px;
  height: 16px;
  background: var(--ally-deep);
  border-radius: 2px;
}

.puzzle-empty {
  width: 16px;
  height: 16px;
}

.puzzle-turn {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--ink);
}


.mode-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin: 20px auto;
}

.mode-btn {
  background: var(--empty);
  border: 2px solid transparent;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.2s;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.mode-btn.active {
  background: var(--panel);
  border-color: var(--ally-base);
  box-shadow: 0 0 0 2px var(--ally-base);
}

.mode-btn:hover {
  transform: translateY(-2px);
}

.mode-btn strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.mode-btn small {
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--panel);
  padding: 32px;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.danger-button {
  background: #ff4d4f;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}
.danger-button:hover { background: #ff7875; }

.char-select-btn {
  background: #ffffff;
  color: var(--ink);
  border: 2px solid var(--line);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 0.95rem;
  transition: all 0.2s;
}
.char-select-btn:hover { background: var(--empty); border-color: var(--accent); }

.secondary-button {
  background: var(--empty);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}
.secondary-button:hover { background: var(--wall); }

.primary-button {
  background: linear-gradient(135deg, #38263f, #865478);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

.result-content {
  max-width: 500px;
}

.result-title {
  font-size: 2.5rem;
  margin: 0 0 16px;
  color: var(--ink);
}

.result-score-large {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.result-score-large #resultPlayerScore { color: var(--ally-deep); }
.result-score-large #resultRivalScore { color: var(--rival-deep); }

.result-quotes {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  text-align: left;
}

.quote-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--empty);
  padding: 16px;
  border-radius: 12px;
}

.quote-avatar {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.quote-box p {
  margin: 0;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
  font-size: 0.95rem;
}

.result-actions {
  justify-content: center;
  gap: 16px;
}

/* タイトル＆チュートリアル、出撃準備画面 */
.title-screen, .setup-screen {
  width: 100%;
  max-width: 800px;
  padding: 40px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.44)),
    rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.title-screen {
  text-align: center;
}

.title-screen .main-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 8px;
}

.title-screen .subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

.tutorial-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
  text-align: left;
}

.tutorial-box h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.3rem;
  color: var(--ink);
}

.tutorial-box ul {
  padding-left: 20px;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.start-button.large {
  padding: 16px 32px;
  font-size: 1.2rem;
  border-radius: 12px;
}

.back-button {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px 32px;
  font-size: 1.2rem;
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  font-weight: bold;
  transition: background 0.2s;
}
.back-button:hover {
  background: var(--empty);
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

/* スマホ用コントローラー */
.mobile-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.d-pad {
  display: grid;
  grid-template-areas: 
    ". up ."
    "left . right"
    ". down .";
  gap: 8px;
}
.d-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: 0 4px 10px rgba(62, 45, 77, 0.15);
  color: var(--ink);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.d-btn:active {
  transform: scale(0.9);
  background: var(--empty);
}
.d-btn.up { grid-area: up; }
.d-btn.left { grid-area: left; }
.d-btn.right { grid-area: right; }
.d-btn.down { grid-area: down; }

.return-setup-button {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-weight: bold;
}

@media (min-width: 901px) {
  .mobile-controls {
    display: none;
  }
}

/* スキルカットイン演出 */
.skill-cutin {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.skill-cutin::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  animation: cutinBgFade 1.8s ease forwards;
}

.cutin-content {
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, rgba(255,111,159,0.9), rgba(232,181,91,0.9));
  padding: 20px 40px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: skewX(-10deg) translateX(-150%);
  opacity: 0;
  position: relative;
  border: 4px solid #fff;
  animation: cutinSlide 1.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

.cutin-content > * {
  transform: skewX(10deg); /* unskew contents */
}

.cutin-portrait {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid #fff;
  overflow: hidden;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  color: var(--ally-deep);
  position: relative;
}

.cutin-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.cutin-text {
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.cutin-char-name {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 700;
  opacity: 0.9;
}

.cutin-skill-name {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

@keyframes cutinSlide {
  0% { transform: skewX(-10deg) translateX(-150%); opacity: 0; }
  15% { transform: skewX(-10deg) translateX(0); opacity: 1; }
  85% { transform: skewX(-10deg) translateX(10%); opacity: 1; }
  100% { transform: skewX(-10deg) translateX(150%); opacity: 0; }
}

@keyframes cutinBgFade {
  0% { opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 900px) {
  .game-panel {
    padding: 16px;
  }

  .team-preview,
  .setup,
  .board-wrap {
    grid-template-columns: 1fr;
  }

  .selector-card {
    grid-template-columns: 1fr;
  }

  .start-button {
    min-height: 48px;
  }

  .score-strip {
    grid-template-columns: 1fr;
  }

  .score-block.rival {
    text-align: left;
  }

  .board {
  position: relative;
    gap: 3px;
    padding: 7px;
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-1deg); }
  40% { transform: translateX(8px) rotate(1deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.color-dot {
  display: inline-block !important;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.2);
}
.name-text {
  vertical-align: middle;
}

.log-box {
  height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.puzzle-piece.selected {
  outline: 3px solid var(--accent);
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.2);
}

.avatar {
  background: var(--empty);
  color: var(--ink);
  display: grid;
  place-content: center;
  border-radius: 50%;
  font-weight: bold;
  overflow: hidden;
  position: relative;
}
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#boardContainer {
  aspect-ratio: 15 / 11;
  width: 100%;
}

.quote-banner {
  position: fixed;
  top: 24px;
  bottom: auto;
  left: 50%;
  transform: translate(-50%, -150%);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 6px solid var(--accent);
  border-top: none;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease-out;
  opacity: 0;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.quote-banner.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.quote-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--empty);
  flex-shrink: 0;
  border: 2px solid var(--accent);
  position: relative;
}

.quote-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quote-content strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--ink);
}

.quote-content p {
  font-size: 1rem;
  font-weight: bold;
  color: var(--ink);
  margin: 0;
}

.playlog-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 20px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  font-weight: bold;
  color: var(--text-main);
  text-align: center;
}
.playlog-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.char-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (min-width: 600px) {
  .char-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.filter-select {
  padding: 6px 12px;
  border-radius: 20px;
  border: 2px solid var(--line);
  background: #ffffff;
  font-weight: bold;
  color: var(--ink);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}
.filter-select:focus {
  border-color: var(--accent);
}

.char-card {
  word-break: break-word;
}

.cutin-content {
  max-width: 90vw;
}

.cutin-portrait {
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .cutin-content {
    padding: 16px 20px;
    gap: 16px;
  }
  .cutin-portrait {
    width: 64px;
    height: 64px;
  }
  .cutin-char-name {
    font-size: 1rem;
  }
  .cutin-skill-name {
    font-size: 1.2rem;
  }
  .cutin-quote {
    font-size: 0.8rem;
  }
}

.cutin-quote {
  font-size: 0.9rem;
  margin-top: 4px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  color: white;
}
