:root {
  --bg: #344268;
  --bg-2: #2c375a;
  --card: #f3f4f8;
  --ink: #252733;
  --line: #b6b5bf;
  --accent: #7f8cff;
  --body-bg: radial-gradient(circle at top, #3f4f7e 0%, #273150 58%, #1e2742 100%);
  --content-max: 820px;
  --text-scale: 1;
  --font-body: "Inter", "Segoe UI", Arial, sans-serif;
  --font-display: "Baloo 2", "Trebuchet MS", "Segoe UI", sans-serif;

  --primary-dark: #1a2e4a;
  --primary-blue: #4a7ba7;
  --secondary-blue: #5591d0;
  --accent-blue: #6ba3d9;
  --light-bg: #f5f7fa;
  --white: #ffffff;
  --text-dark: #1a1a1a;
  --text-light: #666666;
  --border-light: #e0e0e0;
  --success-green: #4CAF50;
  --warning-orange: #FF9800;
  --error-red: #FF6B6B;

  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --transition: all 0.3s ease;
  --wcag-navy: #173052;
  --wcag-navy-strong: #112743;
  --wcag-blue-soft: #cfe0f6;
  --wcag-blue-border: #9fb9da;
  --wcag-blue-accent: #6f9dd2;
  --wcag-text-mid: #42516a;
  --wcag-text-soft: #56647a;
  --wcag-focus: #dbe7ff;
  --surface-1: #fdfdfd;
  --surface-2: #f2f3f5;
  --surface-3: #f7f9fd;
  --surface-4: #eef2fa;
  --surface-raised: rgba(243, 244, 248, 0.98);
  --surface-overlay: #fcfdff;
  --surface-glass: rgba(255, 255, 255, 0.2);
  --text-strong: #1a2947;
  --text-default: #3d3d4a;
  --text-muted: #42516a;
  --text-subtle: #56647a;
  --border-soft: rgba(115, 132, 190, 0.2);
  --border-strong: rgba(83, 126, 181, 0.76);
  --shadow-strong: 0 16px 32px rgba(12, 18, 36, 0.25);
  --dock-bg: #f2f3f5;
  --dock-text: #272731;
  --dock-active: #0f2f64;
  --dock-hover: rgba(95, 159, 221, 0.2);
  --button-primary-bg: linear-gradient(180deg, #7f8cff 0%, #5f9fdd 100%);
  --button-primary-text: #ffffff;
  --button-soft-bg: rgba(231, 240, 252, 0.96);
  --button-soft-border: rgba(207, 224, 246, 0.95);
  --button-soft-text: #112743;
  --avatar-green-start: #4caf50;
  --avatar-green-end: #45a049;
  --avatar-blue-start: #2196f3;
  --avatar-blue-end: #1976d2;
  --avatar-red-start: #ff6b6b;
  --avatar-red-end: #ee5a4a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 10px;
  transform: translateY(-140%);
  padding: 8px 12px;
  border-radius: 10px;
  background: #ffffff;
  color: #1a2947;
  font-weight: 700;
  text-decoration: none;
  z-index: 250;
  border: 2px solid rgba(95, 159, 221, 0.7);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

html,
body {
  width: 100%;
  height: 100%;
  font-size: calc(100% * var(--text-scale));
}

body {
  font-family: var(--font-body);
  background: var(--body-bg);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  overflow-y: hidden;
}

h1,
h2,
h3,
.page-title,
.hero-title,
.section-title {
  font-family: var(--font-display);
}

body.dark-mode {
  --bg: #1b2338;
  --bg-2: #131a2c;
  --card: #202a40;
  --ink: #edf2ff;
  --line: #6e7d9d;
  --body-bg: radial-gradient(circle at top, #25304b 0%, #171f35 55%, #0e1524 100%);
  --surface-1: #202a40;
  --surface-2: #1a2235;
  --surface-3: #26314a;
  --surface-4: #1f2a43;
  --surface-raised: rgba(24, 32, 50, 0.98);
  --surface-overlay: #202b43;
  --surface-glass: rgba(18, 26, 42, 0.72);
  --text-strong: #f1f5ff;
  --text-default: #dbe4f7;
  --text-muted: #c3d0e9;
  --text-subtle: #aeb8cf;
  --border-soft: rgba(123, 143, 184, 0.34);
  --border-strong: rgba(140, 165, 214, 0.7);
  --shadow-strong: 0 18px 36px rgba(3, 8, 18, 0.42);
  --dock-bg: #172033;
  --dock-text: #e8eefc;
  --dock-active: #9fc4ff;
  --dock-hover: rgba(127, 166, 238, 0.18);
  --button-primary-bg: linear-gradient(180deg, #8aa6ff 0%, #5d8fd6 100%);
  --button-primary-text: #f8fbff;
  --button-soft-bg: rgba(38, 52, 82, 0.95);
  --button-soft-border: rgba(140, 165, 214, 0.62);
  --button-soft-text: #eef4ff;
  --wcag-focus: #89aef0;
}

body.colorblind-mode {
  --accent: #2b7de9;
  --wcag-blue-accent: #2b7de9;
  --wcag-focus: #ffd54f;
  --button-primary-bg: linear-gradient(180deg, #1f77d0 0%, #f2a93b 100%);
  --button-soft-bg: rgba(235, 243, 251, 0.98);
  --button-soft-border: rgba(43, 125, 233, 0.42);
  --button-soft-text: #173052;
  --avatar-green-start: #0f8b8d;
  --avatar-green-end: #0b6e70;
  --avatar-blue-start: #2b7de9;
  --avatar-blue-end: #1f5fb4;
  --avatar-red-start: #d68c00;
  --avatar-red-end: #a86900;
}

body.dark-mode.colorblind-mode {
  --button-soft-bg: rgba(39, 55, 86, 0.96);
  --button-soft-border: rgba(242, 169, 59, 0.52);
  --button-soft-text: #f3f7ff;
}

body.inverted-mode .page,
body.inverted-mode .phone,
body.inverted-mode .app-container,
body.inverted-mode .members-shell {
  filter: invert(1) hue-rotate(180deg);
}

body.inverted-mode.colorblind-mode .page,
body.inverted-mode.colorblind-mode .phone,
body.inverted-mode.colorblind-mode .app-container,
body.inverted-mode.colorblind-mode .members-shell {
  filter: invert(1) hue-rotate(190deg) saturate(0.8);
}

.phone {
  width: 100vw;
  min-height: 100dvh;
  background: linear-gradient(165deg, var(--bg) 0%, var(--bg-2) 100%);
  border-radius: 0;
  padding: max(10px, env(safe-area-inset-top)) clamp(10px, 2.8vw, 14px)
    calc(max(12px, env(safe-area-inset-bottom)) + 86px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2.2vw, 12px);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  overscroll-behavior-y: contain;
}

.phone::-webkit-scrollbar {
  display: none;
}

.app-header {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding: 16px 12px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-spacer {
  width: 40px;
  height: 1px;
}

.page-title {
  font-size: clamp(1.5rem, 2vw + 1rem, 2.4rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f6f7ff;
  text-align: center;
}

.page,
.app-container,
.members-shell {
  min-height: 100dvh;
  padding-bottom: 96px;
}

.page-dock .dock-link {
  background: transparent;
  border: none;
}

.page-dock .dock-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--dock-active) 60%, transparent);
  outline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid var(--wcag-focus);
  outline-offset: 3px;
}

.page-dock .dock-link.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

.accessibility-panel {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(92vw, 420px);
  background: var(--surface-raised);
  color: var(--text-strong);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-strong);
  border: 1px solid var(--border-soft);
  display: none;
  z-index: 140;
}

.accessibility-panel.is-open {
  display: block;
}

.a11y-row,
.a11y-range {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-weight: 600;
  color: var(--text-strong);
}

.a11y-row input,
.a11y-range input {
  accent-color: var(--accent);
}

.app-container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 96px;
}

.page-view {
  width: 100%;
  display: flex;
  justify-content: center;
}

.page-content {
  width: min(100%, 820px);
  margin: 0 auto;
}

.squad-scene {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.members-shell {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 96px;
  overflow-y: auto;
}

.members-list {
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .app-container,
  .members-shell,
  .page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .accessibility-panel {
    width: calc(100% - 24px);
  }
}

/* ===== PAGE VIEWS ===== */
.page-view {
    flex: 1;
    overflow: hidden;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    min-height: 0;
}

.page-view.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.page-content {
    padding: 14px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    padding-bottom: 88px;
}

/* ===== SQUAD PAGE ===== */
.squad-scene {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-height: 0;
}

.focus-area {
    display: none;
    width: 100%;
    flex: 1;
    min-height: 0;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 0;
}

.mini-rail {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: auto;
    min-height: 74px;
}

.squad-grid {
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

@media (max-width: 520px) {
  .squad-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
}

.top-slot {
    grid-column: span 2;
}

.slot-placeholder {
    grid-column: span 1;
    aspect-ratio: 1 / 1;
    visibility: hidden;
}

.member-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--surface-2);
    border-radius: 16px;
    padding: 8px;
    aspect-ratio: 1 / 1;
}

.member-card--rounded {
  border-radius: 24px;
}

.add-slot {
  background-color: var(--surface-2);
  border: 2px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.add-slot-plus,
.add-slot-text {
  color: var(--text-default);
}

.member-card:hover {
    transform: translateY(-2px);
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: var(--transition);
    flex-shrink: 0;
}

.avatar-green {
    background: linear-gradient(135deg, var(--avatar-green-start) 0%, var(--avatar-green-end) 100%);
}

.avatar-blue {
    background: linear-gradient(135deg, var(--avatar-blue-start) 0%, var(--avatar-blue-end) 100%);
}

.avatar-red {
    background: linear-gradient(135deg, var(--avatar-red-start) 0%, var(--avatar-red-end) 100%);
}

.member-card:hover .member-avatar {
    box-shadow: none;
}

.member-avatar svg {
    width: 30px;
    height: 30px;
}

.member-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    width: 100%;
}

.member-name {
    color: var(--wcag-navy-strong);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
}

.member-role {
    color: var(--wcag-text-mid);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
}

.member-skills {
    color: var(--wcag-text-soft);
    font-size: 8px;
    font-weight: 500;
    line-height: 1.1;
    text-align: center;
}

.member-details {
    display: none;
    color: var(--wcag-text-mid);
    font-size: 9px;
    line-height: 1.25;
    text-align: center;
}

.member-action {
    font-size: 9px;
    color: var(--wcag-navy);
    font-weight: 600;
    text-align: center;
}

/* ...existing code... */

.page-content.focus-active .continue-btn {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.page-content.focus-active .focus-area {
    display: flex;
}

.page-content.focus-active .squad-scene {
    flex: 1;
    justify-content: space-between;
}

.page-content.focus-active .mini-rail {
    display: flex;
    margin-top: 12px;
}

.page-content.focus-active .squad-grid {
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.focus-selected {
    width: min(58vw, 250px);
    max-width: 250px;
    height: 132px;
    min-height: 132px;
    border-radius: 22px;
    padding: 12px;
    padding-top: 32px;
    transform-origin: left center;
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: width 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
    overflow: hidden;
}

.focus-selected .member-avatar {
    width: 92px;
    height: 92px;
}

.focus-selected .member-avatar svg {
    width: 62px;
    height: 62px;
}

.focus-selected .member-name {
    font-size: 16px;
}

.focus-selected .member-role {
    font-size: 13px;
}

.focus-selected .member-skills {
    font-size: 11px;
}

.focus-selected .member-action {
    font-size: 11px;
}

.focus-expanded {
    width: min(88vw, 430px);
    max-width: 430px;
    height: 132px;
    min-height: 132px;
    padding-top: 32px;
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 26px;
    overflow: hidden;
}

.focus-expanded .member-meta {
    align-items: flex-start;
    text-align: left;
    flex: 1;
    gap: 2px;
    overflow: hidden;
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.focus-expanded.focus-text-ready .member-meta {
    opacity: 1;
    transform: translateX(0);
}

.focus-expanded .member-name {
    font-size: 18px;
    line-height: 1.1;
    text-align: left;
}

.focus-expanded .member-role {
    font-size: 14px;
    text-align: left;
}

.focus-expanded .member-skills {
    font-size: 12px;
    line-height: 1.2;
    text-align: left;
}

.focus-expanded .member-details {
    display: block;
    font-size: 11px;
    line-height: 1.25;
    margin-top: 2px;
    text-align: left;
    overflow: hidden;
}

.focus-expanded .member-action {
    display: none;
}

.focus-expanded .member-avatar {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}

.focus-expanded .member-avatar svg {
    width: 64px;
    height: 64px;
}

.mini-token {
    width: 54px;
    height: 54px;
    min-width: 54px;
    min-height: 54px;
    aspect-ratio: 1 / 1;
    border-radius: 999px;
    padding: 0;
    gap: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-token.member-card {
    background: transparent;
    box-shadow: none;
    position: relative;
    overflow: visible;
}
.mini-token.member-card::after {
    content: attr(data-initials);
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-strong);
    line-height: 1;
    white-space: nowrap;
}

.mini-token.member-card .member-avatar {
    width: 100%;
    height: 100%;
}

.mini-token.member-card .member-avatar svg {
    width: 34px;
    height: 34px;
}

.mini-token .member-meta,
.mini-token .member-action,
.mini-token .add-slot-text {
    display: none;
}

.mini-token.add-slot {
    background-color: var(--line);
}

.mini-token.add-slot .add-slot-plus {
    font-size: 30px;
    line-height: 1;
}

/* ===== BUTTONS ===== */
.continue-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: 999px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: none;
    margin-top: 8px;
    flex-shrink: 0;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.continue-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: none;
}

.continue-btn:active:not(:disabled) {
    transform: translateY(0);
}

.continue-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== BOTTOM PAGE DOCK ===== */
.page-dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    height: 72px;
    background-color: var(--dock-bg);
    border-radius: 20px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    box-shadow: 0 5px 18px rgba(7, 13, 27, 0.28);
    z-index: 120;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (min-width: 900px) {
    .page-dock.is-hidden {
        transform: translateY(120%);
        opacity: 0;
        pointer-events: none;
    }
}

.dock-link {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dock-text);
    text-decoration: none;
    transition: var(--transition);
    border-radius: 16px;
}

.dock-link:hover {
    background-color: var(--dock-hover);
}

.dock-link.active {
    color: var(--dock-active);
}

.dock-icon {
    width: 34px;
    height: 34px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: none;
    border: none;
    color: var(--secondary-blue);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: var(--spacing-sm);
    margin-left: calc(var(--spacing-sm) * -1);
    transition: var(--transition);
    margin-bottom: var(--spacing-lg);
}

.back-btn:hover {
    color: var(--accent-blue);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

.remove-btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background-color: var(--error-red);
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: var(--spacing-md);
}

.remove-btn:hover {
    background-color: #ee5a4a;
    transform: translateY(-2px);
}

/* ===== MEMBER DETAIL PAGE ===== */
.member-detail {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.member-detail-avatar {
    width: 140px;
    height: 140px;
    border-radius: var(--radius-lg);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.member-detail-name {
    text-align: center;
    color: var(--white);
    font-size: 24px;
    font-weight: 700;
}

.skills-section,
.experience-section {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    backdrop-filter: blur(4px);
}

.skills-section h3,
.experience-section h3 {
    color: var(--white);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.skill-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 60px;
    background-color: var(--white);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-dark);
    text-align: center;
    padding: var(--spacing-xs);
}

.experience-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.8;
}

.member-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

/* ===== STARTER PAGE ===== */
.starter-page .page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px 96px;
}

.starter-page .hero {
    flex: 1;
    width: min(100%, var(--content-max));
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-copy {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.starter-page .hero-title-card {
    position: relative;
    width: fit-content;
    max-width: 100%;
    padding: clamp(10px, 2vw, 16px) clamp(18px, 4vw, 32px);
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    background: linear-gradient(160deg, var(--surface-glass) 0%, rgba(233, 240, 255, 0.14) 100%);
    box-shadow: 0 14px 30px rgba(11, 20, 41, 0.26);
    backdrop-filter: blur(5px);
}

.starter-page .hero-title-card::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.hero-title {
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    color: #f6f7ff;
    text-shadow: 0 3px 12px rgba(20, 30, 60, 0.4);
    line-height: 1;
    margin: 0;
}

.hero-lower {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
}

.hero-lower p {
    color: rgba(244, 247, 255, 0.85);
    font-size: clamp(1rem, 2.6vw, 1.3rem);
    line-height: 1.2;
}

.hero-actions {
    width: 100%;
    display: flex;
    justify-content: center;
}

.cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 240px;
    padding: 14px 30px 16px;
    border-radius: 999px;
    background: var(--button-primary-bg);
    color: var(--button-primary-text);
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 3vw, 1.7rem);
    text-decoration: none;
    box-shadow: 0 16px 30px rgba(22, 36, 62, 0.26);
}

/* ===== MEMBERS PAGE ===== */
.members-shell {
    min-height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 16px 96px;
}

.members-list {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 8px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.members-page .members-list .member-card {
    background: linear-gradient(165deg, var(--surface-3) 0%, var(--surface-4) 100%);
    border-radius: 30px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 12px 30px rgba(12, 18, 36, 0.2);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.members-list .member-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.members-list .member-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border-soft);
    background: var(--surface-2);
}

.members-list .member-info {
    flex: 1;
    min-width: 0;
}

.members-list .member-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0 0 4px 0;
}

.members-list .member-skills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.members-list .skills-label {
    font-size: 0.75rem;
    color: var(--text-strong);
    font-weight: 600;
}

.members-list .skills-icons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.members-list .skill-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
}

.members-page .members-list .member-experience {
    background: color-mix(in srgb, var(--surface-3) 88%, transparent);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.9rem;
    color: var(--text-strong);
    border: 1px solid var(--border-soft);
}

.members-page .members-list .member-experience p {
    color: var(--text-default);
}

.members-page .member-experience--expanded {
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-3) 100%);
    border: 1px solid var(--border-soft);
}

.members-page .experience-sections {
    margin-top: 8px;
    display: grid;
    gap: 10px;
}

.members-page .experience-subsection {
    background: color-mix(in srgb, var(--surface-1) 90%, transparent);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 10px 12px;
}

.members-page .experience-subsection h3 {
    margin: 0 0 6px 0;
    color: var(--text-strong);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.members-page .experience-subsection p,
.members-page .experience-subsection ul {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.members-page .experience-subsection ul {
    padding-left: 16px;
}

.members-page .experience-subsection li + li {
    margin-top: 4px;
}

.members-list .experience-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-strong);
    display: block;
    margin-bottom: 2px;
}

.members-list .member-actions {
    display: flex;
    gap: 12px;
}

.members-list .remove-btn,
.members-list .continue-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.95rem;
}

/* ===== REDIRECT PAGE ===== */
.redirect-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px 96px;
}

.redirect-card {
    margin-top: 32px;
    background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
    border-radius: 18px;
    padding: 24px;
    text-align: center;
    color: var(--text-strong);
    box-shadow: 0 10px 24px rgba(12, 18, 36, 0.2);
}

.redirect-card p {
    color: var(--text-strong);
    margin-bottom: 16px;
}

/* ===== ACCESSIBILITY PAGE ===== */
.accessibility-settings {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.setting-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    color: var(--white);
    font-size: 16px;
    font-weight: 500;
}

.setting-item:hover {
    background-color: rgba(91, 145, 208, 0.2);
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ===== ACCESSIBILITY ===== */
.accessibility-settings input[type="checkbox"]:checked + span::after {
    content: '✓';
}

h2 {
    color: var(--white);
    font-size: 28px;
    margin-bottom: var(--spacing-lg);
}

p {
    color: rgba(255, 255, 255, 0.8);
}

/* ===== SUMMARY BLOCKS ===== */
.card {
  width: min(100%, 720px);
  margin: 0 auto;
  background: var(--surface-1);
  border-radius: 26px;
  padding: 18px 20px;
  box-shadow: 0 10px 22px rgba(12, 18, 36, 0.18);
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.section-title-wrap .line {
  flex: 1;
  height: 3px;
  background: color-mix(in srgb, var(--text-default) 45%, transparent);
  border-radius: 999px;
}

.section-title {
  color: var(--text-default);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
}

.scenario-heading {
  font-size: 1.9rem;
  color: var(--text-default);
  margin-bottom: 6px;
}

.scenario-text {
  color: var(--text-default);
  font-size: 1.1rem;
  line-height: 1.2;
}

.squad-card .squad-member {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 2px solid color-mix(in srgb, var(--text-default) 30%, transparent);
}

.squad-card .squad-member:first-of-type {
  border-top: none;
  padding-top: 0;
}

.squad-card h3 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--text-default);
}

.squad-card p {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-default);
}

/* ===== MEMBERS SCROLL ===== */
.members-shell {
  max-height: 100dvh;
  overflow: hidden;
}

.members-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 120px;
}

.members-list::-webkit-scrollbar {
  display: none;
}

/* ===== HOW TO PLAY ===== */
.how-to-play-card {
  margin-top: 12px;
}

.how-to-play-steps {
  margin: 12px 0 0 20px;
  color: var(--text-default);
  font-weight: 600;
  line-height: 1.5;
}

.cta.secondary {
  background: transparent;
  border: 2px solid color-mix(in srgb, var(--button-primary-text) 70%, transparent);
  color: var(--button-primary-text);
  box-shadow: none;
}

.hero-actions {
  gap: 14px;
  flex-wrap: wrap;
}

.help-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--button-soft-border);
  background: var(--button-soft-bg);
  color: var(--button-soft-text);
  font-weight: 700;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 20, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 135;
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.info-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 420px);
  background: var(--surface-overlay);
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 30px rgba(10, 16, 30, 0.3);
  padding: 16px;
  display: none;
  z-index: 140;
}

.info-modal.is-open {
  display: block;
}

.info-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.info-modal-header h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 1.4rem;
}

.info-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-strong);
  cursor: pointer;
}

.info-modal-body {
  margin-top: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.info-modal-body ol {
  margin-left: 18px;
  line-height: 1.5;
}

/* ===== MEMBER PICKER ===== */
.picker-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 440px);
  background: var(--surface-overlay);
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 30px rgba(10, 16, 30, 0.3);
  padding: 16px;
  display: none;
  z-index: 140;
}

.picker-modal.is-open {
  display: block;
}

.picker-subtitle {
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.picker-list {
  display: grid;
  gap: 8px;
  max-height: min(60vh, 320px);
  overflow-y: auto;
  padding-right: 2px;
}

.picker-list::-webkit-scrollbar {
  width: 4px;
}

.picker-list::-webkit-scrollbar-thumb {
  background: rgba(61, 61, 74, 0.3);
  border-radius: 999px;
}

.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface-3);
  font-weight: 600;
  color: var(--text-strong);
  cursor: pointer;
}

.picker-item span {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.picker-item:disabled,
.picker-item-disabled {
  cursor: not-allowed;
  opacity: 0.72;
  background: var(--surface-4);
  color: var(--text-muted);
}

/* ===== SLOT LAYOUT ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.replace-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--button-soft-border);
  background: var(--button-soft-bg);
  color: var(--button-soft-text);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.replace-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.slot-item {
  aspect-ratio: 1 / 1;
  width: 100%;
}

.squad-grid {
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

@media (max-width: 520px) {
  .squad-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
}

.member-card,
.add-slot {
  aspect-ratio: 1 / 1;
}

.add-slot {
  background-color: var(--surface-2);
  border: 2px dashed var(--border-strong);
}

.add-slot-plus,
.add-slot-text {
  color: var(--text-default);
}

.slot-selected {
  box-shadow: 0 0 0 3px rgba(219, 231, 255, 0.95);
}

/* ===== SQUAD PAGE ENHANCED LAYOUT ===== */
.squad-page .page-content {
  width: min(100%, 960px);
}

.squad-page .squad-grid {
  width: min(100%, 860px);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  padding: 12px 4px;
  justify-items: stretch;
}

.squad-page .squad-grid .slot-item {
  grid-column: span 2;
  width: 100%;
}

.squad-page .squad-grid .slot-item:nth-child(4) {
  grid-column: 2 / span 2;
}

.squad-page .squad-grid .slot-item:nth-child(5) {
  grid-column: 4 / span 2;
}

.squad-page .squad-grid .member-card,
.squad-page .squad-grid .add-slot {
  min-height: clamp(170px, 24vw, 220px);
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 10px 22px rgba(14, 22, 42, 0.2);
  border: 1px solid var(--border-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.squad-page .squad-grid .member-card {
  background: linear-gradient(165deg, var(--surface-3) 0%, var(--surface-4) 100%);
}

.squad-page .squad-grid .add-slot {
  background: linear-gradient(165deg, var(--surface-2) 0%, var(--surface-4) 100%);
  border: 2px dashed var(--border-strong);
}

.squad-page .squad-grid .member-card:hover,
.squad-page .squad-grid .add-slot:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 26px rgba(16, 27, 54, 0.25);
  border-color: color-mix(in srgb, var(--dock-active) 35%, transparent);
}

.squad-page .squad-grid .slot-selected {
  box-shadow: 0 0 0 3px rgba(219, 231, 255, 0.96), 0 14px 28px rgba(22, 32, 62, 0.3);
}

.squad-page .squad-grid .member-avatar {
  width: 62px;
  height: 62px;
}

.squad-page .squad-grid .member-avatar svg {
  width: 38px;
  height: 38px;
}

.squad-page .squad-grid .member-name {
  font-size: 0.82rem;
}

.squad-page .squad-grid .member-role {
  font-size: 0.74rem;
}

.squad-page .squad-grid .member-skills,
.squad-page .squad-grid .member-action {
  font-size: 0.68rem;
}

.squad-page .header-actions {
  margin-left: auto;
}

.squad-page .replace-btn,
.squad-page .help-btn {
  box-shadow: 0 8px 16px rgba(12, 20, 40, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.squad-page .replace-btn:hover:not(:disabled),
.squad-page .help-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 20px rgba(12, 20, 40, 0.3);
}

@media (max-width: 720px) {
  .squad-page .squad-grid {
    gap: 12px;
  }

  .squad-page .squad-grid .member-card,
  .squad-page .squad-grid .add-slot {
    min-height: clamp(142px, 28vw, 176px);
    padding: 10px;
  }

  .squad-page .squad-grid .member-avatar {
    width: 54px;
    height: 54px;
  }
}

/* ===== SUMMARY DETAILS ===== */
.summary-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 2px solid color-mix(in srgb, var(--text-default) 30%, transparent);
}

.summary-item:first-child {
  border-top: none;
  padding-top: 0;
}

.summary-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-default);
}

.save-btn {
  width: min(100%, 320px);
  align-self: center;
  margin: 8px auto 24px;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
  font-weight: 700;
  cursor: pointer;
}

.summary-page .phone {
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== MEMBER MIND MAP ===== */
.member-card--rounded {
  border-radius: 30px;
}

.members-page .mindmap {
  --active-angle: 0deg;
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 1 / 1;
  height: auto;
  margin: 12px auto 8px;
  border-radius: 28px;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--surface-4) 85%, transparent) 0%, color-mix(in srgb, var(--surface-1) 55%, transparent) 48%, rgba(255, 255, 255, 0) 72%);
  overflow: hidden;
}

.members-page .mindmap-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.members-page .mindmap-links line {
  stroke: color-mix(in srgb, var(--dock-active) 28%, transparent);
  stroke-width: 1.8;
}

.members-page .mindmap-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 136px;
  height: 136px;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-4) 100%);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 30px rgba(15, 29, 60, 0.22);
  text-align: center;
  padding: 14px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.members-page .mindmap:hover .mindmap-center {
  transform: translate(-50%, -50%) scale(1.04);
  box-shadow: 0 18px 34px rgba(15, 29, 60, 0.26);
}

.members-page .mindmap-focus {
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: 0.02em;
}

.members-page .mindmap-skill {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  background: color-mix(in srgb, var(--surface-1) 95%, transparent);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: normal;
  text-align: center;
  line-height: 1.2;
  max-width: 98px;
  min-height: 34px;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease, border-color 0.22s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.members-page .mindmap-skill:hover,
.members-page .mindmap-skill:focus-visible,
.members-page .mindmap-skill.is-active {
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(55, 81, 150, 0.35);
  transform: translate(-50%, -50%) scale(1.08);
  outline: none;
}

.members-page .mindmap-detail {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--surface-1) 90%, transparent);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .members-page .app-header {
    padding: 12px 8px 6px;
  }

  .members-page .page-title {
    font-size: 1.6rem;
    letter-spacing: 0.05em;
  }

  .members-shell {
    padding: 0 12px 92px;
  }

  .members-list {
    gap: 14px;
    padding: 4px 0 112px;
  }

  .members-page .members-list .member-card {
    padding: 16px;
    border-radius: 24px;
    gap: 12px;
  }

  .members-list .member-card-header {
    align-items: flex-start;
    gap: 12px;
  }

  .members-list .member-avatar {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
  }

  .members-list .member-name {
    font-size: 0.95rem;
    margin-bottom: 6px;
    line-height: 1.2;
  }

  .members-list .member-skills {
    gap: 8px;
  }

  .members-list .skills-icons {
    gap: 5px;
  }

  .members-list .skill-icon {
    width: 22px;
    height: 22px;
  }

  .members-page .member-experience--expanded {
    padding: 12px;
  }

  .members-page .experience-subsection {
    padding: 10px;
  }

  .members-page .mindmap {
    width: min(100%, 440px);
    margin: 8px auto 6px;
  }

  .members-page .mindmap-center {
    width: 120px;
    height: 120px;
    padding: 12px;
  }

  .members-page .mindmap-skill {
    max-width: 88px;
    min-height: 32px;
    padding: 6px 10px;
  }
}

@media (max-width: 520px) {
  .members-page {
    font-size: 14px;
  }

  .members-page .app-header {
    padding: 10px 6px 4px;
    gap: 8px;
  }

  .members-page .page-title {
    font-size: 1.35rem;
    letter-spacing: 0.04em;
  }

  .members-page .header-spacer {
    width: 20px;
  }

  .members-shell {
    gap: 10px;
    padding: 0 10px 90px;
  }

  .members-list {
    gap: 12px;
    padding-bottom: 110px;
  }

  .members-page .members-list .member-card {
    padding: 14px;
    border-radius: 22px;
  }

  .members-list .member-card-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .members-list .member-info {
    width: 100%;
  }

  .members-list .member-name {
    font-size: 0.92rem;
  }

  .members-list .member-skills {
    justify-content: center;
    gap: 6px;
  }

  .members-list .skills-icons {
    justify-content: center;
    gap: 4px;
  }

  .members-list .skill-icon {
    width: 20px;
    height: 20px;
  }

  .members-list .skills-label,
  .members-list .experience-label {
    font-size: 0.72rem;
  }

  .members-page .members-list .member-experience {
    padding: 8px 10px;
  }

  .members-page .experience-subsection h3 {
    font-size: 0.72rem;
  }

  .members-page .experience-subsection p,
  .members-page .experience-subsection ul {
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .members-page .mindmap {
    width: min(100%, 300px);
  }

  .members-page .mindmap-center {
    width: 82px;
    height: 82px;
    border-radius: 14px;
    padding: 6px;
    font-size: 0.74rem;
  }

  .members-page .mindmap-skill {
    font-size: 0.56rem;
    padding: 3px 6px;
    max-width: 52px;
    min-height: 22px;
    line-height: 1.1;
  }

  .members-page .mindmap-detail {
    max-width: 86%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.66rem;
    bottom: 8px;
    padding: 4px 8px;
  }
}

@media (max-width: 380px) {
  .members-page {
    font-size: 13px;
  }

  .members-shell {
    padding-left: 8px;
    padding-right: 8px;
  }

  .members-page .members-list .member-card {
    padding: 12px;
  }

  .members-list .member-avatar {
    width: 42px;
    height: 42px;
  }

  .members-page .mindmap {
    width: min(100%, 264px);
  }

  .members-page .mindmap-center {
    width: 72px;
    height: 72px;
    font-size: 0.68rem;
  }

  .members-page .mindmap-skill {
    max-width: 46px;
    font-size: 0.5rem;
    min-height: 20px;
    padding: 2px 5px;
  }
}

@media print {
  body {
    background: #fff;
    color: #111;
  }

  .page-dock,
  .action-btn,
  .help-btn,
  .replace-btn,
  .save-btn,
  .modal-overlay,
  .info-modal,
  .picker-modal,
  .accessibility-panel {
    display: none !important;
  }

  .phone {
    background: #fff;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
