:root {
      --blue: #002595;
      --deep-blue: #07143e;
      --ink: #070e30;
      --muted: #64656b;
      --line: #d9d9df;
      --surface: #f7f7f8;
      --header-height: 76px;
      --footer-height: 76px;
    }

    * { box-sizing: border-box; }

    html, body { height: 100%; }

    body {
      margin: 0;
      min-width: 320px;
      overflow: hidden;
      color: var(--ink);
      background: var(--surface);
      font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
    }

    button { font: inherit; }

    .app-shell {
      height: 100vh;
      height: 100dvh;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr) auto;
      overflow: hidden;
      background: var(--surface);
    }

    .portal-header {
      position: relative;
      z-index: 20;
      min-height: var(--header-height);
      display: flex;
      align-items: center;
      gap: 16px;
      padding: 14px 20px;
      padding-top: max(14px, env(safe-area-inset-top));
      color: #fff;
      background: linear-gradient(180deg, #174bad 0%, #073aa6 48%, #002595 100%);
    }

    .portal-header h1 {
      min-width: 0;
      margin: 0;
      overflow: hidden;
      font-size: clamp(23px, 6.8vw, 32px);
      font-weight: 750;
      line-height: 1.1;
      letter-spacing: -.025em;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: auto;
    }

    .icon-button,
    .avatar {
      min-width: 44px;
      min-height: 44px;
      display: grid;
      place-items: center;
      padding: 0;
      color: #fff;
      border: 0;
      background: transparent;
    }

    .icon-button { font-size: 26px; }

    .avatar {
      width: 44px;
      height: 44px;
      border: 1px solid rgba(255, 255, 255, .65);
      border-radius: 50%;
      font-size: 17px;
      font-weight: 700;
    }

    .scroll-area {
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior-y: contain;
      -webkit-overflow-scrolling: touch;
      scrollbar-gutter: stable;
      background: var(--surface);
    }

    .ticket {
      width: min(100%, 680px);
      min-height: 100%;
      margin: 0 auto;
      padding: 28px 20px 42px;
      text-align: center;
    }

    .qr-card {
      width: min(100%, 390px);
      aspect-ratio: 1;
      display: grid;
      place-items: center;
      margin: 0 auto 24px;
      padding: 24px;
      border: 1px solid #8a8b8f;
      background: #fff;
    }

    .qr-demo {
      width: 100%;
      height: 100%;
      position: relative;
      border: 16px solid #fff;
      background:
        linear-gradient(90deg, transparent 48%, var(--ink) 48% 57%, transparent 57%),
        linear-gradient(transparent 43%, var(--ink) 43% 52%, transparent 52%),
        repeating-conic-gradient(from 90deg, var(--ink) 0 25%, #fff 0 50%) 50% / 38px 38px;
    }

    .finder {
      position: absolute;
      width: 30%;
      aspect-ratio: 1;
      border: 14px solid var(--ink);
      background: #fff;
      box-shadow: inset 0 0 0 12px #fff, inset 0 0 0 28px var(--ink);
    }

    .finder.one { top: 0; left: 0; }
    .finder.two { top: 0; right: 0; }
    .finder.three { bottom: 0; left: 0; }

    .ticket h2 {
      margin: 0 0 14px;
      font-size: clamp(28px, 8vw, 42px);
      line-height: 1.12;
    }

    .status {
      display: inline-flex;
      margin-bottom: 28px;
      padding: 7px 16px;
      border-radius: 999px;
      background: #f0f0f1;
      font-size: 15px;
      font-weight: 700;
    }

    .description {
      max-width: 520px;
      margin: 0 auto 24px;
      color: var(--muted);
      font-size: 18px;
      line-height: 1.55;
    }

    .code-label {
      display: block;
      margin-bottom: 4px;
      color: var(--muted);
      font-size: 16px;
    }

    .code {
      display: block;
      margin-bottom: 28px;
      color: var(--blue);
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: clamp(27px, 8vw, 40px);
      font-weight: 800;
      letter-spacing: .08em;
    }

    .ticket-actions {
      display: grid;
      gap: 14px;
    }

    .button,
    .download-trigger {
      width: 100%;
      min-height: 58px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 13px 18px;
      color: var(--blue);
      border: 2px solid var(--blue);
      background: #fff;
      font-size: 18px;
      font-weight: 750;
    }

    .download {
      position: relative;
    }

    .download-trigger {
      justify-content: space-between;
    }

    .download-trigger span:last-child {
      transition: transform .16s ease-out;
    }

    .download-trigger[aria-expanded="true"] span:last-child {
      transform: rotate(180deg);
    }

    .download-menu {
      position: absolute;
      z-index: 30;
      right: 0;
      bottom: calc(100% + 6px);
      left: 0;
      display: none;
      padding: 6px 12px;
      border: 1px solid var(--line);
      background: #fff;
      box-shadow: 0 8px 20px rgba(7, 14, 48, .16);
    }

    .download-menu.open { display: block; }

    .download-menu button {
      width: 100%;
      min-height: 50px;
      padding: 10px 0;
      color: var(--ink);
      border: 0;
      border-bottom: 1px solid var(--line);
      background: #fff;
      text-align: left;
    }

    .download-menu button:last-child { border-bottom: 0; }

    .scroll-check {
      margin: 32px 0 0;
      padding: 18px;
      color: var(--muted);
      border-left: 4px solid #69c0ac;
      background: #fff;
      text-align: left;
      line-height: 1.55;
    }

    .mobile-nav {
      position: relative;
      z-index: 20;
      min-height: var(--footer-height);
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      padding-bottom: env(safe-area-inset-bottom);
      border-top: 1px solid var(--line);
      background: #fff;
    }

    .mobile-nav button {
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      padding: 8px 4px;
      color: #a8a9ad;
      border: 0;
      background: #fff;
      font-size: 12px;
    }

    .mobile-nav button span:first-child { font-size: 25px; }
    .mobile-nav button.active { color: var(--blue); font-weight: 700; }

    @media (min-width: 700px) {
      body { display: grid; place-items: center; padding: 24px; background: #e8e8ec; }
      .app-shell { width: 430px; max-height: 900px; border: 1px solid #c9c9cf; box-shadow: 0 18px 48px rgba(7,14,48,.18); }
    }

    @media (prefers-reduced-motion: reduce) {
      * { scroll-behavior: auto !important; transition: none !important; }
    }
