@layer reset, base, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { color-scheme: dark; scroll-behavior: smooth; }
  body, h1, h2, h3, p, ul, ol, figure { margin: 0; }
  ul, ol { padding: 0; }
  img, svg { display: block; max-width: 100%; }
  button, input, textarea { font: inherit; }
  button, a { -webkit-tap-highlight-color: transparent; }
}

@layer base {
  :root {
    --background: #070a16;
    --surface: #10162a;
    --surface-light: #171f38;
    --surface-raised: #1c2542;
    --for-pink: #ff2d8d;
    --for-pink-light: #ff66ae;
    --against-blue: #176bff;
    --against-blue-light: #4c8dff;
    --text-primary: #f8f9ff;
    --text-secondary: #aab2cc;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);
    --border-glow: rgba(255, 255, 255, 0.28);
    --success: #57d6a1;
    --warning: #ffc766;
    --danger: #ff6f7d;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    --shadow-soft: 0 18px 46px rgba(0, 0, 0, 0.24);
    --glow-pink: 0 0 42px rgba(255, 45, 141, 0.16);
    --glow-blue: 0 0 42px rgba(23, 107, 255, 0.16);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --container: 1180px;
    --font-display: "Aptos Display", "Segoe UI Variable Display", "Inter", sans-serif;
    --font-body: "Aptos", "Segoe UI Variable Text", "Inter", sans-serif;
  }

  body {
    min-width: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background:
      radial-gradient(circle at 82% -12%, rgba(23, 107, 255, 0.18), transparent 34rem),
      radial-gradient(circle at -10% 24%, rgba(255, 45, 141, 0.13), transparent 30rem),
      linear-gradient(180deg, rgba(255,255,255,.025), transparent 18rem),
      var(--background);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
  }

  a { color: inherit; text-decoration: none; }
  p { color: var(--text-secondary); }
  h1, h2, h3 { font-family: var(--font-display); line-height: 1.08; letter-spacing: -0.035em; text-wrap: balance; }
  h1 { font-size: clamp(2.25rem, 6vw, 4.7rem); }
  h2 { font-size: clamp(1.75rem, 4vw, 3rem); }
  h3 { font-size: clamp(1.12rem, 1.8vw, 1.45rem); }
  ::selection { background: rgba(255, 45, 141, 0.36); color: #fff; }
  :focus-visible { outline: 3px solid var(--for-pink-light); outline-offset: 3px; }
}

@layer components {
  .container { width: min(calc(100% - 40px), var(--container)); margin-inline: auto; }
  .narrow-container { width: min(calc(100% - 40px), 820px); margin-inline: auto; }

  .skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    transform: translateY(-150%);
    padding: 10px 14px;
    border-radius: 8px;
    background: #fff;
    color: #070a16;
    font-weight: 800;
  }
  .skip-link:focus { transform: translateY(0); }

  .site-header {
    position: relative;
    z-index: 50;
    border-bottom: 1px solid transparent;
  }
  .site-header.is-sticky {
    position: sticky;
    top: 0;
    border-bottom-color: var(--border);
    background: rgba(7, 10, 22, 0.86);
    backdrop-filter: blur(18px);
  }
  .header-inner { min-height: 78px; display: flex; align-items: center; justify-content: flex-start; gap: 20px; }
  .brand { display: inline-flex; align-items: center; gap: 12px; font-size: 1.25rem; font-weight: 850; letter-spacing: -0.04em; }
  .brand img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 14px 28px rgba(0,0,0,.22); }
  .brand-word { position: relative; }
  .brand-word::after {
    content: "";
    position: absolute;
    right: -8px;
    bottom: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--for-pink);
  }
  .desktop-nav { display: none; align-items: center; gap: 8px; padding: 5px; border: 1px solid rgba(255,255,255,.055); border-radius: 999px; background: rgba(255,255,255,.025); }
  .nav-link { padding: 9px 14px; border-radius: 999px; color: var(--text-secondary); font-size: 0.92rem; font-weight: 720; transition: color 160ms ease, background 160ms ease, transform 160ms ease; }
  .nav-link:hover, .nav-link[aria-current="page"] { color: var(--text-primary); background: rgba(255, 255, 255, 0.075); }
  .nav-link:hover { transform: translateY(-1px); }
  .header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
  .public-account-profile { display: inline-flex; align-items: center; gap: 9px; min-height: 42px; padding: 4px 11px 4px 5px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-primary); font-size: .9rem; font-weight: 780; background: rgba(255,255,255,.035); }
  .public-account-profile:hover { border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.075); }
  .public-account-avatar { width: 32px; height: 32px; font-size: .76rem; }
  .public-account-logout { min-height: 42px; padding-inline: 15px; }
  .global-menu-logout { width: 100%; border: 0; background: transparent; cursor: pointer; font-family: inherit; text-align: left; }
  .menu-button { display: none; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: #fff; cursor: pointer; }
  .menu-button span { display: block; width: 18px; height: 2px; margin: 4px auto; background: currentColor; }
  .global-menu { position: relative; flex: 0 0 auto; }
  .global-menu-button { display: block; background: rgba(255,255,255,.045); border-color: var(--border-strong); box-shadow: inset 0 0 0 1px rgba(255,255,255,.02); }
  .global-menu-button:hover { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.08); }
  .global-menu-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    z-index: 200;
    width: min(320px, calc(100vw - 28px));
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(23,31,56,.98), rgba(12,17,34,.98));
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
  }
  .global-menu-panel[hidden] { display: none; }
  .global-menu-link { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 13px; border-radius: 12px; color: var(--text-secondary); font-size: .92rem; font-weight: 800; }
  .global-menu-link::after { content: "→"; opacity: 0; transform: translateX(-4px); transition: opacity 160ms ease, transform 160ms ease; }
  .global-menu-link:hover::after, .global-menu-link[aria-current="page"]::after { opacity: .65; transform: translateX(0); }
  .global-menu-link:hover, .global-menu-link[aria-current="page"] { background: rgba(255,255,255,.065); color: var(--text-primary); }
  .global-menu-link.is-primary { margin-top: 4px; background: var(--text-primary); color: #070a16; }
  .global-menu-link.is-primary:hover { background: #fff; color: #070a16; }
  .header-actions .menu-button:not(.global-menu-button) { display: none !important; }
  .mobile-menu { display: none; padding: 10px 20px 18px; border-bottom: 1px solid var(--border); background: var(--background); }
  .mobile-menu[aria-hidden="false"] { display: grid; gap: 5px; }

  .button {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 780;
    line-height: 1;
    box-shadow: 0 12px 34px rgba(0,0,0,.16);
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
  }
  .button:hover { transform: translateY(-2px); box-shadow: 0 16px 42px rgba(0,0,0,.24); }
  .button:active { transform: translateY(0); }
  .button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }
  .button-primary { background: var(--text-primary); color: #080b18; }
  .button-primary:hover { background: #fff; }
  .button-pink { background: var(--for-pink); color: #fff; box-shadow: 0 10px 30px rgba(255, 45, 141, 0.2); }
  .button-blue { background: var(--against-blue); color: #fff; box-shadow: 0 10px 30px rgba(23, 107, 255, 0.2); }
  .button-secondary { border-color: var(--border-strong); background: rgba(255, 255, 255, 0.04); color: var(--text-primary); }
  .button-secondary:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.07); }
  .button-danger { border-color: rgba(255, 111, 125, 0.32); background: rgba(255, 111, 125, 0.08); color: #ffb1ba; }
  .button-small { min-height: 39px; padding-inline: 15px; font-size: 0.9rem; }
  .button-full { width: 100%; }
  .text-link { color: var(--text-primary); font-weight: 800; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.35); text-underline-offset: 4px; }
  .text-link:hover { text-decoration-color: var(--for-pink); }
  .text-button { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: .82rem; font-weight: 850; cursor: pointer; }
  .text-button:hover { color: var(--text-primary); }
  .report-button { color: #ffb6bd; }
  .report-button:hover { color: #fff; }

  .eyebrow { display: flex; align-items: center; gap: 9px; color: var(--text-secondary); font-size: 0.76rem; font-weight: 820; letter-spacing: 0.15em; text-transform: uppercase; }
  .eyebrow::before { content: ""; width: 22px; height: 2px; background: linear-gradient(90deg, var(--against-blue) 50%, var(--for-pink) 50%); }
  .section-heading { display: grid; grid-template-columns: 1fr minmax(240px, 420px); align-items: end; gap: 36px; margin-bottom: 40px; }
  .section-heading .eyebrow { margin-bottom: 15px; }
  .section-heading p { font-size: 1.05rem; }

  .panel { border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(23,31,56,.92), rgba(13,18,35,.9)); box-shadow: var(--shadow); }
  .surface-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(16,22,42,.98), rgba(12,17,34,.94)); box-shadow: var(--shadow-soft); }

  .side-label { display: inline-flex; align-items: center; gap: 7px; font-size: 0.73rem; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
  .side-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
  .side-label.for { color: var(--for-pink-light); }
  .side-label.for::before { background: var(--for-pink); box-shadow: 0 0 0 4px rgba(255, 45, 141, 0.12); }
  .side-label.against { color: var(--against-blue-light); }
  .side-label.against::before { background: var(--against-blue); box-shadow: 0 0 0 4px rgba(23, 107, 255, 0.12); }

  .status-pill { display: inline-flex; align-items: center; gap: 8px; width: fit-content; min-height: 30px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-secondary); font-size: 0.75rem; font-weight: 800; }
  .status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .status-pill.waiting { border-color: rgba(255, 199, 102, 0.22); background: rgba(255, 199, 102, 0.07); color: var(--warning); }
  .status-pill.cancelled { color: var(--text-secondary); }
  .status-pill.open { border-color: rgba(87, 214, 161, 0.22); color: var(--success); }

  .field { display: grid; gap: 8px; }
  .field-row { display: flex; justify-content: space-between; gap: 12px; }
  .field label, .field-label { color: var(--text-primary); font-size: 0.9rem; font-weight: 750; }
  .field-note, .character-count { color: var(--text-secondary); font-size: 0.8rem; }
  .input, .textarea {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: rgba(7, 10, 22, 0.72);
    color: var(--text-primary);
    transition: border-color 160ms ease, box-shadow 160ms ease;
  }
  .input { height: 50px; padding: 0 15px; }
  .textarea { min-height: 130px; resize: vertical; padding: 14px 15px; line-height: 1.55; }
  .input::placeholder, .textarea::placeholder { color: #737c9c; }
  .input:focus, .textarea:focus { outline: none; border-color: var(--against-blue-light); box-shadow: 0 0 0 4px rgba(23, 107, 255, 0.12); }
  .checkbox-field { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; font-size: 0.88rem; color: var(--text-secondary); }
  .checkbox-field input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--for-pink); }
  .form-stack { display: grid; gap: 20px; }
  .form-message { padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; color: var(--text-secondary); font-size: 0.9rem; }
  .form-message.error { border-color: rgba(255, 111, 125, 0.34); background: rgba(255, 111, 125, 0.08); color: #ffb6bd; }
  .form-message.success { border-color: rgba(87, 214, 161, 0.3); background: rgba(87, 214, 161, 0.07); color: #99e7c5; }

  .avatar { width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 50%; background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.16), transparent 34%), var(--surface-light); color: #fff; font-weight: 850; box-shadow: 0 12px 26px rgba(0,0,0,.18); }
  .avatar img { width: 100%; height: 100%; object-fit: cover; }

  .loading-state, .empty-state, .error-state { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 12px; padding: 30px; text-align: center; }
  .loading-mark { width: 30px; height: 30px; border: 3px solid rgba(255, 255, 255, 0.12); border-top-color: var(--for-pink); border-right-color: var(--against-blue); border-radius: 50%; animation: spin 800ms linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  .configuration-card { max-width: 620px; margin: 60px auto; padding: 32px; }
  .configuration-card h2 { margin: 12px 0 10px; font-size: 1.8rem; }
  .configuration-card code { color: #dbe2ff; }

  .toast-region { position: fixed; z-index: 1000; right: 18px; bottom: 18px; display: grid; gap: 10px; width: min(380px, calc(100% - 36px)); }
  .toast { padding: 13px 15px; border: 1px solid var(--border-strong); border-radius: 10px; background: #161d34; box-shadow: 0 16px 50px rgba(0,0,0,.4); color: #fff; font-size: .92rem; }
  .toast.error { border-color: rgba(255, 111, 125, 0.45); }
  .toast.success { border-color: rgba(87, 214, 161, 0.42); }
  .offline-banner { position: fixed; z-index: 999; left: 50%; bottom: 18px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 36px); padding: 9px 14px; border: 1px solid rgba(255, 199, 102, .35); border-radius: 999px; background: #28200f; color: #ffe0a5; font-size: .82rem; font-weight: 700; box-shadow: var(--shadow); }
  .report-dialog { width: min(520px, calc(100vw - 28px)); border: 1px solid var(--border-strong); border-radius: 24px; background: var(--surface); color: var(--text-primary); padding: 0; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
  .report-dialog::backdrop { background: rgba(0,0,0,.62); backdrop-filter: blur(8px); }
  .report-form { display: grid; gap: 18px; padding: 26px; }
  .report-dialog-header h2 { margin-top: 8px; font-size: 1.65rem; }
  .report-dialog-header p:not(.eyebrow) { margin-top: 8px; color: var(--text-secondary); }
  .report-actions { display: flex; justify-content: flex-end; gap: 10px; }

  .site-footer { padding: 38px 0; border-top: 1px solid var(--border); }
  .footer-inner { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; }
  .footer-brand p { margin-top: 7px; font-size: .86rem; }
  .footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 24px; color: var(--text-secondary); font-size: .88rem; }
  .footer-links a:hover { color: #fff; }

  .legal-page { padding: 62px 0 90px; }
  .legal-header { padding-bottom: 32px; border-bottom: 1px solid var(--border); }
  .legal-header h1 { margin: 12px 0 14px; font-size: clamp(2.15rem, 6vw, 3.7rem); }
  .legal-content { display: grid; gap: 34px; padding-top: 40px; }
  .legal-content section { display: grid; gap: 12px; }
  .legal-content h2 { font-size: 1.45rem; }
  .legal-content ul { display: grid; gap: 8px; padding-left: 20px; color: var(--text-secondary); }
  .legal-content strong { color: var(--text-primary); }
}

@layer utilities {
  [hidden] { display: none !important; }
  .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
  .muted { color: var(--text-secondary); }
  .no-scroll { overflow: hidden; }
}

@media (max-width: 760px) {
  .container, .narrow-container { width: min(calc(100% - 28px), var(--container)); }
  .desktop-nav, .header-actions .nav-link, .header-actions .button-secondary { display: none; }
  .menu-button { display: none; }
  .global-menu-button { display: block; }
  .header-inner { min-height: 66px; }
  .header-actions .public-account-profile, .header-actions .public-account-logout { display: inline-flex !important; }
  .public-account-profile > span:last-child { display: none; }
  .public-account-profile { padding: 4px; gap: 0; }
  .public-account-logout { min-height: 38px; padding-inline: 12px; font-size: .82rem; }
  .section-heading { grid-template-columns: 1fr; gap: 16px; margin-bottom: 28px; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
  .legal-page { padding-top: 36px; }
}

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