:root {
  color-scheme: dark;
  --bg: #101116;
  --bg-glow: rgba(67, 194, 223, 0.09);
  --sidebar: #22252e;
  --surface: #1b1e26;
  --surface-2: #242834;
  --surface-3: #2e3342;
  --field: #151820;
  --subtle-tile: rgba(255, 255, 255, 0.03);
  --drop-bg: #171a22;
  --drop-line: #465064;
  --avatar-bg: #11141b;
  --ink: #f4f7ff;
  --muted: #9ca6b8;
  --line: #343a49;
  --accent: #43c2df;
  --accent-strong: #69def3;
  --accent-soft: rgba(67, 194, 223, 0.16);
  --gold: #d7b85c;
  --danger: #f25b70;
  --ok: #36d296;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf3f8;
  --bg-glow: rgba(22, 138, 164, 0.1);
  --sidebar: #252936;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --surface-3: #e8eef6;
  --field: #ffffff;
  --subtle-tile: #eef3f8;
  --drop-bg: #f8fbff;
  --drop-line: #b8c7d9;
  --avatar-bg: #e5edf6;
  --ink: #101724;
  --muted: #5d6b80;
  --line: #ccd6e4;
  --accent: #0788a8;
  --accent-strong: #006f8f;
  --accent-soft: rgba(7, 136, 168, 0.11);
  --gold: #9a6800;
  --danger: #c5344d;
  --ok: #16895b;
  --shadow: 0 14px 34px rgba(48, 62, 82, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

body,
button,
input,
textarea,
select {
  font: 14px/1.45 Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
}

button,
a,
select,
input,
textarea {
  color: inherit;
}

button {
  border: 0;
}

a {
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  background:
    linear-gradient(90deg, var(--sidebar) 0 176px, transparent 176px),
    radial-gradient(circle at 30% 0%, var(--bg-glow), transparent 34rem),
    var(--bg);
}

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  padding: 14px 8px;
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.brand-panel {
  min-height: 86px;
  padding: 10px;
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(67, 194, 223, 0.16), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.brand-panel img {
  width: 32px;
  height: 32px;
  display: block;
  margin-bottom: 7px;
  border-radius: 8px;
}

.brand-panel strong {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}

.brand-panel span {
  display: block;
  margin-top: 4px;
  color: #b8c0cf;
  font-size: 12px;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.side-nav a,
.side-tab {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 4px;
  background: transparent;
  color: #d6dbe6;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  transition: transform 120ms ease, background 140ms ease, color 140ms ease;
}

.side-nav a:hover,
.side-nav a.active,
.side-tab:hover,
.side-tab.active {
  background: #383d4d;
  color: #fff;
}

.side-footer {
  margin-top: auto;
  padding-top: 14px;
  display: grid;
  gap: 8px;
}

.side-footer .settings-contact-button {
  border-color: rgba(67, 194, 223, 0.42);
  background: rgba(67, 194, 223, 0.1);
  color: #dbe6f4;
}

.side-footer .settings-contact-button:hover {
  border-color: rgba(105, 222, 243, 0.78);
  background: rgba(67, 194, 223, 0.18);
  color: #ffffff;
}

.contact-button,
.update-button {
  min-height: 34px;
  border: 1px solid rgba(67, 194, 223, 0.42);
  border-radius: 5px;
  background: rgba(67, 194, 223, 0.1);
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 900;
  transition: transform 120ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.contact-button:hover,
.update-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.update-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.update-status {
  display: grid;
  gap: 4px;
  min-height: 18px;
  color: #b8c0cf;
  font-size: 11px;
  line-height: 1.45;
}

.update-status strong {
  color: #ffffff;
  font-size: 12px;
}

.update-status a,
.update-apply-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid rgba(64, 255, 202, 0.5);
  border-radius: 5px;
  color: var(--accent-strong);
  background: rgba(64, 255, 202, 0.1);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.side-footer .contact-button,
.side-footer .update-button,
.side-footer .theme-toggle {
  border-color: rgba(67, 194, 223, 0.42);
  background: rgba(67, 194, 223, 0.1);
  color: #dbe6f4;
}

.side-footer .contact-button:hover,
.side-footer .update-button:hover,
.side-footer .theme-toggle:hover {
  border-color: rgba(105, 222, 243, 0.78);
  background: rgba(67, 194, 223, 0.18);
  color: #ffffff;
}

.side-footer .theme-toggle[aria-pressed="true"] {
  border-color: rgba(105, 222, 243, 0.72);
  color: #69def3;
}

.update-status small {
  color: #b8c0cf;
}

.web-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid rgba(67, 194, 223, 0.5);
  border-radius: 6px;
  background: rgba(67, 194, 223, 0.12);
  color: #69def3;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.web-download-btn:hover {
  background: rgba(67, 194, 223, 0.22);
  border-color: rgba(105, 222, 243, 0.78);
  color: #ffffff;
}

.app-main {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 16px 18px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.eyebrow,
.section-kicker {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

h1 {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.25;
}

h2 {
  font-size: 17px;
  font-weight: 900;
}

.topbar-actions,
.status-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(320px, 400px);
  gap: 12px;
  align-items: stretch;
  min-height: 0;
}

.union-view {
  display: none;
  min-height: 0;
}

.content-stack,
.result-column {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.content-stack {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.result-column {
  grid-template-rows: minmax(0, 1fr) auto;
}

.app-main[data-view="recommendations"] .workspace {
  grid-template-columns: 1fr;
}

.app-main[data-view="recommendations"] .content-stack,
.app-main[data-view="recommendations"] .feedback-panel {
  display: none;
}

.app-main[data-view="recommendations"] .result-column {
  grid-template-rows: minmax(0, 1fr);
}

.app-main[data-view="setup"] .workspace {
  grid-template-columns: minmax(700px, 1fr) minmax(300px, 340px);
}

.app-main[data-view="setup"] .roster-panel {
  order: 1;
}

.app-main[data-view="setup"] .character-panel {
  order: 2;
}

.app-main[data-view="setup"] .guide-strip {
  display: none;
}

.app-main[data-view="setup"] .capture-box {
  order: 3;
}

.app-main[data-view="union"] .workspace {
  display: none;
}

.app-main[data-view="union"] .union-view {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(360px, 0.85fr);
  gap: 12px;
  min-height: 0;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tutorial-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-soft) 74%, var(--surface));
  box-shadow: var(--shadow);
}

.tutorial-banner[hidden] {
  display: none;
}

.tutorial-banner div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tutorial-banner strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.tutorial-banner span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.roster-panel,
.character-panel,
.capture-box,
.result-panel,
.feedback-panel {
  padding: 12px;
}

.app-main[data-view="setup"] .feedback-panel {
  padding: 10px;
  max-height: 230px;
  overflow: auto;
}

.capture-box {
  min-height: 0;
}

.app-main[data-view="setup"] .roster-panel,
.app-main[data-view="setup"] .capture-box,
.app-main[data-view="setup"] .result-panel {
  padding: 10px;
}

.app-main[data-view="setup"] .roster-panel .helper-text,
.app-main[data-view="setup"] .capture-box .helper-text {
  font-size: 12px;
  line-height: 1.35;
}

.app-main[data-view="setup"] .capture-box .panel-header {
  margin-bottom: 8px;
}

.app-main[data-view="setup"] .capture-box .primary-button {
  min-height: 30px;
}

.app-main[data-view="setup"] .capture-preview img {
  max-height: 96px;
}

.app-main[data-view="setup"] .detected-team {
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.summary-pill,
.data-chip,
.sync-chip,
.feedback-total-chip,
.tier-select,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.summary-pill,
.data-chip,
.sync-chip,
.feedback-total-chip {
  padding: 0 10px;
}

.summary-pill span:first-child {
  color: var(--accent-strong);
  font-size: 15px;
  margin-right: 3px;
}

.tier-select {
  gap: 8px;
  padding: 0 10px;
}

.tier-select select {
  min-width: 118px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
}

.tier-select option {
  color: #111827;
}

.theme-toggle {
  justify-content: center;
  width: 100%;
  cursor: pointer;
  color: #dbe6f4;
}

.theme-toggle[aria-pressed="true"] {
  border-color: rgba(67, 194, 223, 0.55);
  color: var(--accent-strong);
}

.sync-chip[data-state="ok"] {
  border-color: rgba(54, 210, 150, 0.6);
  color: var(--ok);
}

.sync-chip[data-state="loading"] {
  border-color: rgba(67, 194, 223, 0.6);
  color: var(--accent-strong);
}

.sync-chip[data-state="error"] {
  border-color: rgba(242, 91, 112, 0.65);
  color: var(--danger);
}

.feedback-total-chip {
  border-color: rgba(215, 184, 92, 0.55);
  color: var(--gold);
  white-space: nowrap;
}

.feedback-total-chip[hidden] {
  display: none;
}

.ghost-button,
.filter-button,
.primary-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  transition: transform 120ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.ghost-button:hover,
.filter-button:hover,
.theme-toggle:hover,
.character-card:hover {
  border-color: var(--accent);
}

.ghost-button:not(:disabled):active,
.filter-button:not(:disabled):active,
.primary-button:not(:disabled):active,
.feedback-button:not(:disabled):active,
.manual-slot:not(:disabled):active,
.side-tab:not(:disabled):active,
.contact-button:not(:disabled):active,
.update-button:not(:disabled):active,
.theme-toggle:not(:disabled):active,
.icon-button:not(:disabled):active {
  transform: scale(0.97);
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary-button {
  width: 100%;
  margin-top: 8px;
  border-color: transparent;
  background: var(--accent);
  color: #061016;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.manual-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.helper-text {
  color: var(--muted);
  font-size: 12px;
  user-select: text;
}

.guide-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  align-items: center;
}

.guide-strip strong {
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.guide-strip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  user-select: text;
}

.manual-slot {
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  transition: transform 120ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.manual-slot.active {
  border-color: var(--gold);
  background: rgba(215, 184, 92, 0.16);
}

.manual-slot.filled {
  border-color: rgba(54, 210, 150, 0.62);
  background: rgba(54, 210, 150, 0.12);
}

.selected-team {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
  margin-top: 8px;
}

.team-chip,
.detected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  font-weight: 900;
}

.team-chip small,
.detected-chip small,
.character-info small,
.recommendation-title span,
.chosen-pick small {
  color: var(--muted);
  font-size: 12px;
}

.capture-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.capture-drop {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 1px dashed var(--drop-line);
  border-radius: 5px;
  background: var(--drop-bg);
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.capture-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.capture-preview {
  position: relative;
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-3);
}

.capture-preview img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}

.slot-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.slot-button {
  position: absolute;
  top: 79.8%;
  width: 14.2%;
  height: 7.3%;
  padding: 0 4px;
  overflow: hidden;
  border: 2px solid rgba(244, 247, 255, 0.84);
  border-radius: 4px;
  background: rgba(67, 194, 223, 0.2);
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  pointer-events: auto;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
}

.slot-button[data-slot="0"] {
  left: 49.3%;
}

.slot-button[data-slot="1"] {
  left: 64.2%;
}

.slot-button[data-slot="2"] {
  left: 79%;
}

.slot-button.active {
  border-color: var(--gold);
  background: rgba(215, 184, 92, 0.32);
}

.slot-button.filled {
  border-color: var(--ok);
  background: rgba(54, 210, 150, 0.28);
}

.detected-team {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 22px;
  margin-top: 8px;
}

.detected-status,
.empty-state {
  color: var(--muted);
  font-size: 13px;
  user-select: text;
}

.detected-chip {
  padding: 4px 8px 4px 4px;
}

.detected-chip img {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
}

.search-box {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.search-box input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
  background: var(--field);
  color: var(--ink);
  padding: 0 12px;
}

.search-box input:focus {
  border-color: var(--accent);
}

.filter-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.playable-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.playable-tools span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.playable-tools .active {
  border-color: var(--gold);
  background: rgba(215, 184, 92, 0.14);
  color: var(--gold);
}

.playable-presets {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.2fr) repeat(3, auto);
  gap: 6px;
  margin-top: 8px;
}

.playable-presets input,
.playable-presets select {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: var(--field);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 800;
}

.playable-presets input:focus,
.playable-presets select:focus {
  border-color: var(--accent);
}

.playable-presets .ghost-button {
  white-space: nowrap;
}

.filter-button {
  min-height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

.filter-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  max-height: none;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  padding-top: 2px;
}

.character-panel {
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.app-main[data-view="setup"] .character-grid {
  min-height: 0;
}

.character-grid::-webkit-scrollbar,
.recommendations::-webkit-scrollbar,
.rank-grid::-webkit-scrollbar,
.union-character-grid::-webkit-scrollbar,
.union-results::-webkit-scrollbar {
  width: 8px;
}

.character-grid::-webkit-scrollbar-thumb,
.recommendations::-webkit-scrollbar-thumb,
.rank-grid::-webkit-scrollbar-thumb,
.union-character-grid::-webkit-scrollbar-thumb,
.union-results::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: color-mix(in srgb, var(--muted) 46%, transparent);
}

.character-grid,
.recommendations,
.rank-grid,
.union-character-grid,
.union-results {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 46%, transparent) transparent;
}

.character-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 160ms ease;
}

.character-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 12%, rgba(105, 222, 243, 0.16) 45%, transparent 72%);
  opacity: 0;
  transform: translateX(-70%);
}

.character-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.character-card:active {
  transform: scale(0.985);
}

.character-card[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(215, 184, 92, 0.14);
}

.character-card.pick-pop {
  animation: card-select-pop 180ms ease-out;
}

.character-card.pick-pop::after {
  animation: card-sheen 360ms ease-out;
}

.character-card[data-playable="true"] {
  box-shadow: inset 3px 0 0 var(--accent);
}

.playable-mark {
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid rgba(67, 194, 223, 0.45);
  border-radius: 4px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
}

.avatar,
.recommendation-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: var(--avatar-bg);
  color: var(--accent-strong);
  font-weight: 900;
}

.avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}

.recommendation-avatar {
  width: 42px;
  height: 42px;
}

.avatar img,
.recommendation-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  grid-area: 1 / 1;
}

.avatar span,
.recommendation-avatar span {
  grid-area: 1 / 1;
}

.character-info {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.character-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommendations {
  display: grid;
  gap: 10px;
  max-height: none;
  min-height: 0;
  overflow: auto;
  padding-right: 3px;
}

.setup-recommendation-empty {
  display: grid;
  place-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  user-select: text;
}

.setup-recommendation-empty strong {
  color: var(--ink);
}

.recommendation-stage-notice {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-soft) 54%, var(--surface));
  user-select: text;
}

.recommendation-stage-notice strong {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 950;
}

.recommendation-stage-notice span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.recommendation-hub {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.8fr);
  gap: 12px;
  min-height: 0;
}

.combo-section,
.rank-section {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.combo-section h3,
.rank-section h3 {
  color: var(--ink);
  font-size: 16px;
}

.combo-section h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.combo-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
}

.combo-split > div {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.combo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  align-content: start;
  max-height: 100%;
}

.combo-card {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.combo-card-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
}

.combo-card-head strong {
  color: var(--muted);
  font-size: 11px;
}

.combo-members {
  display: grid;
  gap: 4px;
}

.combo-face {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  justify-items: stretch;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--subtle-tile);
}

.combo-face img,
.rank-card img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
}

.combo-face span,
.rank-card div {
  display: grid;
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.combo-face strong,
.rank-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}

.combo-face small,
.rank-card small,
.combo-card p {
  overflow-wrap: anywhere;
}

.combo-card p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
}

.combo-face small {
  display: -webkit-box;
  overflow: hidden;
  text-align: left;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row span {
  color: var(--muted);
  font-size: 12px;
}

.rank-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.rank-card {
  display: grid;
  grid-template-columns: 24px 36px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.rank-number {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.result-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.recommendation-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.recommendation-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}

.app-main[data-view="recommendations"] .recommendations {
  align-content: stretch;
}

.app-main[data-view="setup"] .recommendations {
  gap: 8px;
}

.app-main[data-view="setup"] .recommendation-card {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 9px;
}

.app-main[data-view="setup"] .recommendation-avatar {
  width: 38px;
  height: 38px;
}

.app-main[data-view="setup"] .recommendation-title {
  gap: 5px;
  margin-bottom: 4px;
}

.app-main[data-view="setup"] .recommendation-title h3 {
  font-size: 15px;
}

.app-main[data-view="setup"] .recommendation-card ul {
  gap: 3px;
  padding-left: 15px;
  font-size: 11px;
  line-height: 1.32;
}

.app-main[data-view="setup"] .recommendation-details ul {
  max-height: 92px;
  overflow: auto;
}

.app-main[data-view="setup"] .feedback-row {
  margin-top: 6px;
}

.app-main[data-view="setup"] .score {
  font-size: 17px;
}

.recommendation-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.recommendation-rank {
  min-width: max-content;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.recommendation-title h3 {
  font-size: 17px;
}

.recommendation-card ul,
.chosen-reasons {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.42;
}

.recommendation-summary {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  user-select: text;
}

.app-main[data-view="setup"] .recommendation-summary {
  margin-bottom: 5px;
  font-size: 12px;
}

.recommendation-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
}

.recommendation-tags:empty {
  display: none;
}

.recommendation-tags span {
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 72%, transparent);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.recommendation-details {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  user-select: text;
}

.recommendation-details summary {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  width: max-content;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  user-select: text;
}

.recommendation-details summary::-webkit-details-marker {
  display: none;
}

.recommendation-details summary::before {
  content: "▶";
  font-size: 9px;
  transition: transform 150ms ease;
}

.recommendation-details[open] summary::before {
  transform: rotate(90deg);
}

.recommendation-details summary:hover {
  color: var(--accent-strong);
}

.recommendation-details ul {
  margin-top: 7px;
}

.union-builder,
.union-result-panel {
  display: grid;
  min-height: 0;
  padding: 12px;
}

.union-builder {
  grid-template-rows: auto auto auto auto auto auto minmax(0, 1fr);
  overflow: hidden;
}
/* union-presets 내부 레이블은 grid 내부 아이템이므로 별도 행 불필요 */

.union-result-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.union-player-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.union-player-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 150ms ease, opacity 140ms ease;
}

.union-player-card:not(.empty):hover {
  transform: translateY(-1px);
}

.union-player-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}

.union-player-card.inactive {
  opacity: 0.62;
}

.union-player-card.empty {
  border-style: dashed;
  background: transparent;
  opacity: 0.82;
}

.union-player-check {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.union-player-fixed {
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid rgba(67, 194, 223, 0.36);
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.union-player-card.empty .union-player-fixed {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.union-player-select {
  display: grid;
  gap: 2px;
  min-height: 42px;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform 120ms ease;
}

.union-player-select:active {
  transform: scale(0.985);
}

.union-player-select small {
  color: var(--muted);
  font-size: 12px;
}

.union-search {
  margin-top: 2px;
  min-height: 0;
}

.union-character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  padding-top: 2px;
  align-content: start;
}

.union-preset-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.union-preset-save-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(80px, 0.7fr);
  gap: 5px;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.union-preset-save-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.union-preset-saved-msg {
  font-size: 11px;
  color: var(--ok);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.union-preset-row {
  display: grid;
  grid-template-columns: 72px minmax(120px, 1fr) auto auto;
  gap: 5px;
  align-items: start;
}

.union-preset-row .union-preset-row-label {
  line-height: 30px;
}

.union-preset-row .union-preset-load-btn {
  align-self: start;
}

.union-preset-row-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.union-preset-save-row input {
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: var(--field);
  color: var(--ink);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.union-preset-save-row input:focus {
  border-color: var(--accent);
}

/* Custom dropdown */
.union-preset-dropdown {
  position: relative;
  min-width: 0;
}

.updd-trigger {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.updd-trigger:hover:not(:disabled) {
  border-color: var(--accent);
}

.updd-open .updd-trigger {
  border-color: var(--accent);
}

.updd-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.updd-arrow {
  font-size: 10px;
  opacity: 0.6;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.updd-open .updd-arrow {
  transform: rotate(180deg);
}

.updd-list {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 220px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.32);
  max-height: min(280px, 42vh);
  overflow-y: auto;
  padding: 2px;
  flex-direction: column;
}

.updd-list.is-open {
  display: flex;
}

.updd-item {
  width: 100%;
  padding: 5px 8px;
  text-align: left;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  border: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.updd-item:hover {
  background: var(--accent-faint, rgba(99, 102, 241, 0.12));
  color: var(--accent);
}

.updd-item.selected {
  color: var(--accent);
}

.union-preset-save-row .ghost-button,
.union-preset-row .ghost-button {
  white-space: nowrap;
  min-height: 30px;
  font-size: 12px;
  padding: 0 8px;
}

.union-result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.union-confirm-button {
  width: auto;
  min-width: 96px;
  padding-inline: 14px;
}

.union-confirm-button[aria-busy="true"] {
  pointer-events: none;
}

.union-loading {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 180px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.union-loading::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: union-spin 760ms linear infinite;
}

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

.union-results {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  align-content: start;
}

.union-combo-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.union-combo-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
}

.union-combo-members {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.union-combo-card .combo-face {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  padding: 6px;
  min-width: 0;
}

.union-combo-card .combo-face img {
  width: 34px;
  height: 34px;
}

.union-combo-card .combo-face strong {
  white-space: normal;
  line-height: 1.2;
  overflow: visible;
  text-overflow: clip;
  word-break: keep-all;
}

.union-combo-card .combo-face small {
  -webkit-line-clamp: 3;
  line-height: 1.25;
  word-break: keep-all;
}

.union-combo-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
  user-select: text;
}

.feedback-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.feedback-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  transition: transform 120ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.feedback-button:hover {
  border-color: var(--accent);
}

.score,
.chosen-score {
  color: var(--gold);
  font-weight: 900;
}

.negative-score {
  color: var(--danger);
}

.score {
  font-size: 22px;
}

.match-feedback {
  min-height: 0;
}

.app-main[data-view="setup"] .feedback-panel .panel-header {
  margin-bottom: 6px;
}

.app-main[data-view="setup"] .feedback-panel .section-kicker {
  font-size: 11px;
}

.app-main[data-view="setup"] .feedback-panel h2 {
  font-size: 15px;
}

.app-main[data-view="setup"] .match-feedback .empty-state {
  font-size: 12px;
}

.chosen-pick {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.chosen-pick img {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
}

.chosen-pick > div:not(.chosen-actions) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.combo-evaluation {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.combo-evaluation strong {
  color: var(--accent-strong);
  font-size: 12px;
}

.combo-evaluation p {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.combo-evaluation .recommendation-tags {
  margin-bottom: 0;
}

.combo-evaluation .recommendation-details {
  font-size: 11px;
}

.combo-evaluation .recommendation-details ul {
  max-height: 64px;
  overflow: auto;
}

.result-image-button {
  width: 100%;
  min-height: 30px;
  margin-top: 8px;
  border: 1px solid rgba(67, 194, 223, 0.42);
  border-radius: 4px;
  background: rgba(67, 194, 223, 0.1);
  color: var(--accent-strong);
  font-weight: 900;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.result-image-button:hover {
  border-color: rgba(105, 222, 243, 0.76);
  background: rgba(67, 194, 223, 0.17);
}

.result-image-button:active {
  transform: translateY(1px) scale(0.99);
}

.chosen-score {
  font-size: 16px;
  min-width: 32px;
  text-align: right;
}

.chosen-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 6px;
}

.icon-button {
  width: 34px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover {
  border-color: var(--accent);
  background: var(--surface-3);
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.9;
}

.feedback-like {
  color: var(--accent-strong);
}

.feedback-dislike,
.clear-pick-button {
  color: var(--danger);
}

.feedback-pop-like {
  animation: feedback-pop 420ms cubic-bezier(0.2, 1.4, 0.35, 1);
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.feedback-pop-like svg,
.feedback-pop-dislike svg {
  animation: feedback-icon-fill 420ms ease;
}

.feedback-pop-dislike {
  animation: feedback-pop 420ms cubic-bezier(0.2, 1.4, 0.35, 1);
  border-color: var(--danger);
  background: rgba(242, 91, 112, 0.14);
  color: var(--danger);
}

.chosen-feedback-done {
  grid-column: 1 / 3;
  display: grid;
  align-items: center;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid rgba(54, 210, 150, 0.36);
  border-radius: 5px;
  background: rgba(54, 210, 150, 0.1);
  animation: feedback-done-in 240ms ease-out;
}

.chosen-feedback-done strong {
  color: var(--ok);
  overflow: hidden;
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chosen-pick > .clear-pick-button {
  justify-self: end;
}

@keyframes feedback-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.28) rotate(-4deg);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes feedback-icon-fill {
  0% {
    fill: transparent;
  }
  55%,
  100% {
    fill: currentColor;
  }
}

@keyframes feedback-done-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-select-pop {
  0% {
    transform: scale(0.985);
  }
  55% {
    transform: scale(1.015);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes card-sheen {
  0% {
    opacity: 0;
    transform: translateX(-72%);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(72%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ghost-button,
  .filter-button,
  .primary-button,
  .feedback-button,
  .manual-slot,
  .side-tab,
  .contact-button,
  .update-button,
  .theme-toggle,
  .icon-button,
  .character-card,
  .recommendation-card,
  .union-player-card,
  .union-player-select,
  .union-combo-card {
    transition: none;
    animation: none;
  }

  .character-card::after {
    animation: none;
  }
}

.compact-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.contact-modal[hidden],
.tutorial-modal[hidden] {
  display: none;
}

.contact-modal,
.tutorial-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
}

.contact-backdrop,
.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 10, 0.68);
  backdrop-filter: blur(6px);
}

.contact-dialog,
.tutorial-dialog {
  position: relative;
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  padding: 16px;
}

.tutorial-dialog {
  display: grid;
  gap: 12px;
}

.tutorial-dialog h2 {
  font-size: 22px;
}

.tutorial-dialog p,
.tutorial-dialog li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.tutorial-dialog ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.tutorial-note {
  padding: 9px 10px;
  border: 1px solid rgba(54, 210, 150, 0.34);
  border-radius: 6px;
  background: rgba(54, 210, 150, 0.1);
  color: var(--ok) !important;
  font-weight: 800;
}

.tutorial-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tutorial-start-button {
  width: auto;
  margin-top: 0;
}

.contact-form {
  display: grid;
  gap: 12px;
}

.contact-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: none;
  background: var(--field);
  color: var(--ink);
  padding: 10px;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
}

.contact-note,
#contact-status {
  color: var(--muted);
  font-size: 12px;
}

.contact-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.contact-actions #contact-status {
  margin-right: auto;
}

.contact-submit {
  width: auto;
  margin-top: 0;
}

/* ── Settings modal ── */
.settings-button {
  min-height: 34px;
  border: 1px solid rgba(67, 194, 223, 0.42);
  border-radius: 5px;
  background: rgba(67, 194, 223, 0.1);
  color: #dbe6f4;
  cursor: pointer;
  font-weight: 900;
  transition: transform 120ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.settings-button:hover {
  border-color: rgba(105, 222, 243, 0.78);
  background: rgba(67, 194, 223, 0.18);
  color: #ffffff;
}

.settings-modal[hidden] {
  display: none;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 10, 0.68);
  backdrop-filter: blur(6px);
}

.settings-dialog {
  position: relative;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  padding: 16px;
  display: grid;
  gap: 0;
}

.settings-body {
  display: grid;
  gap: 20px;
  margin-top: 16px;
}

.settings-section {
  display: grid;
  gap: 8px;
}

.settings-section-label {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

.settings-language-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.settings-language-card {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-raised);
  color: var(--fg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.settings-language-card:hover {
  border-color: rgba(67, 194, 223, 0.6);
  background: rgba(67, 194, 223, 0.1);
  color: #ffffff;
}

.settings-language-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(67, 194, 223, 0.18);
  color: var(--accent-strong);
}

.settings-theme-toggle,
.settings-contact-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-raised);
  color: var(--fg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.settings-theme-toggle:hover,
.settings-contact-button:hover {
  border-color: rgba(67, 194, 223, 0.6);
  background: rgba(67, 194, 223, 0.1);
  color: #ffffff;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px;
  }

  .brand-panel {
    min-height: 58px;
    width: 210px;
  }

  .side-nav {
    display: flex;
    flex-wrap: wrap;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .side-footer {
    margin-top: 0;
    margin-left: auto;
    width: 110px;
    padding-top: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .app-main[data-view="union"] .union-view {
    grid-template-columns: 1fr;
  }

  .recommendation-hub {
    grid-template-columns: 1fr;
  }

  .combo-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-main {
    padding: 16px 12px 24px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .capture-actions {
    grid-template-columns: 1fr;
  }

  .manual-slots,
  .guide-strip,
  .combo-members,
  .recommendation-card {
    grid-template-columns: 1fr;
  }

  .rank-grid,
  .combo-grid,
  .union-player-grid,
  .union-combo-members {
    grid-template-columns: 1fr;
  }

  .playable-presets {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .playable-presets input,
  .playable-presets select {
    grid-column: span 3;
  }

  .union-preset-row {
    grid-template-columns: 60px 1fr auto;
  }

  .chosen-pick {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .score {
    justify-self: start;
  }
}

/* ── Full Team Composition Cards ──────────────────────────────── */
.full-team-section-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 4px;
}

.full-team-section-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0;
}

.full-team-section-header span {
  font-size: 12px;
  color: var(--text-muted);
}

.full-team-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.full-team-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
}

.full-team-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.full-team-score {
  font-size: 16px;
  font-weight: 800;
  color: #f5c518;
}

.full-team-members {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.full-team-member {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 9px;
  align-items: start;
}

.full-team-member .recommendation-avatar {
  width: 36px;
  height: 36px;
}

.full-team-member-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.full-team-member-info strong {
  font-size: 13px;
  color: var(--text-strong);
  line-height: 1.2;
}

.full-team-member-info small {
  font-size: 11px;
  color: var(--text-muted);
}

.full-team-details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.full-team-details summary {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.full-team-details summary::before {
  content: "▶";
  font-size: 9px;
  transition: transform 150ms ease;
}

.full-team-details[open] summary::before {
  transform: rotate(90deg);
}

.full-team-detail-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.full-team-detail-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-strong);
  margin: 6px 0 2px;
}

.full-team-detail-name:first-child {
  margin-top: 0;
}

.full-team-detail-body ul {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.full-team-detail-body li {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.full-team-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

/* ── Show More Button ─────────────────────────────────────────── */
.show-more-button {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 9px 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.show-more-button:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* ── Show More Loading State ──────────────────────────────────── */
.show-more-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.show-more-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ── Feedback CTA Banner (2번) ────────────────────────────────── */
.feedback-cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease;
  position: sticky;
  top: 0;
  z-index: 2;
}

.feedback-cta-banner:hover {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
  border-color: var(--accent);
}

.feedback-cta-banner span {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.feedback-cta-banner strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
  white-space: nowrap;
}

/* ── Feedback Needs-Rating Highlight (4번) ───────────────────── */
/* B: 버튼 배경 채우기 */
#match-feedback[data-needs-rating="true"] .feedback-like {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
}

#match-feedback[data-needs-rating="true"] .feedback-dislike {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  border-color: color-mix(in srgb, var(--danger) 48%, transparent);
}

/* A: 알림 dot 뱃지 */
#match-feedback[data-needs-rating="true"] .feedback-like,
#match-feedback[data-needs-rating="true"] .feedback-dislike {
  position: relative;
  overflow: visible;
}

#match-feedback[data-needs-rating="true"] .feedback-like::after,
#match-feedback[data-needs-rating="true"] .feedback-dislike::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 8px;
  height: 8px;
  background: #f59e0b;
  border-radius: 50%;
  border: 1.5px solid var(--surface);
  pointer-events: none;
}

/* CTA 배너 클릭 후 일회성 스케일 플래시 */
#match-feedback.feedback-highlight-pulse .feedback-like,
#match-feedback.feedback-highlight-pulse .feedback-dislike {
  animation: btn-flash 0.5s cubic-bezier(0.2, 1.4, 0.35, 1) forwards;
}

@keyframes btn-flash {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}

/* ── 5초 딜레이 어텐션 (버튼 무한 바운스) ─────────────────────── */
#match-feedback.feedback-attention .feedback-like {
  animation: btn-attention-bounce 1.8s ease-in-out infinite;
}

#match-feedback.feedback-attention .feedback-dislike {
  animation: btn-attention-bounce 1.8s ease-in-out 0.3s infinite;
}

@keyframes btn-attention-bounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  30%       { transform: scale(1.18) rotate(-6deg); }
  60%       { transform: scale(1.12) rotate(4deg); }
  80%       { transform: scale(1.05) rotate(-2deg); }
}

/* ── Post-Clear Feedback Toast (1번) ─────────────────────────── */
.feedback-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--sidebar);
  border: 1px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
  max-width: 440px;
  width: calc(100vw - 48px);
  animation: toast-in 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-in {
  from {
    transform: translateX(-50%) translateY(calc(100% + 28px));
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.feedback-toast-out {
  animation: toast-out 0.3s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

@keyframes toast-out {
  from {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
  to {
    transform: translateX(-50%) translateY(calc(100% + 28px));
    opacity: 0;
  }
}

.feedback-toast-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.feedback-toast-text {
  flex: 1;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.4;
}

.feedback-toast-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.feedback-toast .feedback-like {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  color: var(--accent-strong);
  position: relative;
  overflow: visible;
}

.feedback-toast .feedback-dislike {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  border-color: color-mix(in srgb, var(--danger) 48%, transparent);
  color: var(--danger);
  position: relative;
  overflow: visible;
}

.feedback-toast .feedback-like::after,
.feedback-toast .feedback-dislike::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 8px;
  height: 8px;
  background: #f59e0b;
  border-radius: 50%;
  border: 1.5px solid var(--sidebar);
  pointer-events: none;
}

.feedback-toast-close {
  color: var(--muted);
}
