:root {
  --navy: #06284c;
  --navy-deep: #031a33;
  --navy-soft: #0a3f70;
  --blue: #079cf3;
  --cyan: #1ed8ff;
  --yellow: #ffc92f;
  --yellow-deep: #ffac16;
  --ink: #071f45;
  --muted: #6d819d;
  --line: #dceaf4;
  --ice: #edf8ff;
  --paper: #ffffff;
  font-family: Inter, "Arial Rounded MT Bold", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #071d36; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100dvh; background: #eaf6fd; }
button, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button { border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.nav-icon, .button-icon { width: 1.45em; height: 1.45em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-icon { width: 22px; height: 22px; flex: 0 0 22px; }
.desktop-notice { display: none; }
.desktop-device body { display: grid; min-height: 100vh; place-items: center; padding: 30px; color: white; background: radial-gradient(circle at 50% 20%, #0a5f9e, #031a33 64%); }
.desktop-device .splash, .desktop-device .app-shell { display: none !important; }
.desktop-device .desktop-notice { display: grid; width: min(520px, 100%); place-items: center; gap: 14px; padding: 34px; text-align: center; border: 1px solid rgba(112,218,255,.35); border-radius: 28px; background: rgba(3,35,65,.82); box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.desktop-device .desktop-notice img { width: 150px; border-radius: 32px; box-shadow: 0 12px 28px rgba(0,0,0,.26); }
.desktop-device .desktop-notice h1 { font-size: clamp(27px, 4vw, 40px); line-height: 1.08; }
.desktop-device .desktop-notice p { max-width: 410px; color: #c8e8fa; line-height: 1.55; }

.splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-content: center;
  gap: 24px;
  color: white;
  background: radial-gradient(circle at 50% 34%, #0b588d, var(--navy-deep) 62%);
  transition: opacity .32s ease, visibility .32s ease;
}
.splash.done { opacity: 0; visibility: hidden; }
.splash-brand, .brand { display: flex; align-items: center; font-weight: 1000; letter-spacing: -1.7px; }
.splash-brand { font-size: clamp(32px, 8vw, 52px); }
.brand { color: white; font-size: 27px; white-space: nowrap; }
.brand b, .splash-brand b { color: var(--cyan); }
.brand-anchor { color: var(--cyan); font-size: 1.32em; margin-right: 8px; line-height: 1; }
.brand i, .splash-brand i { align-self: flex-start; margin: -8px 0 0 -35px; color: var(--yellow); font-size: 16px; font-style: normal; transform: rotate(-8deg); }
.splash-line { width: min(270px, 66vw); height: 5px; overflow: hidden; border-radius: 20px; background: #ffffff20; }
.splash-line span { display: block; width: 42%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), white); animation: loading 1s ease-in-out infinite alternate; }
@keyframes loading { to { transform: translateX(138%); } }
@keyframes spin { to { transform: rotate(360deg); } }

.app-shell { min-height: 100dvh; background: var(--paper); overflow: hidden; }
.stage { min-width: 0; min-height: 100dvh; background: white; }
.sidebar, .tablet-banner { display: none; }

.mobile-hero {
  position: relative;
  height: 370px;
  overflow: hidden;
  isolation: isolate;
  color: white;
  background:
    linear-gradient(90deg, rgba(2,24,51,.96) 0%, rgba(3,42,75,.84) 45%, rgba(5,65,100,.22) 100%),
    url('./assets/hafen.webp') center / cover no-repeat;
}
.mobile-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 90px;
  z-index: -1;
  background: linear-gradient(transparent, rgba(2,21,42,.85));
}
.mobile-topbar { position: relative; z-index: 4; display: flex; align-items: center; justify-content: space-between; padding: calc(20px + env(safe-area-inset-top)) 20px 0; }
.round-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  color: white;
  background: rgba(5,48,88,.72);
  border: 1px solid rgba(129,222,255,.34);
  box-shadow: 0 5px 18px rgba(0,17,44,.24);
  backdrop-filter: blur(8px);
  font-size: 23px;
}
.round-button.working { animation: spin .8s linear infinite; }
.hero-copy { position: absolute; z-index: 3; left: 21px; top: 126px; width: 48%; }
.hero-copy h1 { color: white; font-size: clamp(36px, 11vw, 50px); line-height: .91; letter-spacing: -2.3px; font-weight: 1000; text-shadow: 0 4px 12px rgba(0,24,54,.65); }
.hero-copy h1 span { color: var(--cyan); }
.hero-copy p { margin-top: 17px; color: white; font-size: 14px; line-height: 1.35; font-weight: 800; text-shadow: 0 2px 5px rgba(0,20,50,.6); }
.hero-captain { position: absolute; z-index: 2; right: -39px; bottom: 0; width: min(73%, 310px); filter: drop-shadow(0 13px 18px rgba(0,20,48,.48)); }

.content {
  position: relative;
  z-index: 5;
  min-height: calc(100dvh - 370px);
  margin-top: 0;
  padding: 29px 17px calc(104px + env(safe-area-inset-bottom));
  border-radius: 25px 25px 0 0;
  background: #fafdff;
}
.app-shell:not([data-page="start"]) .mobile-hero { display: none; }
.app-shell:not([data-page="start"]) .content { min-height: 100dvh; margin-top: 0; border-radius: 0; padding-top: calc(27px + env(safe-area-inset-top)); }
.page { display: none; }
.page.active { display: block; animation: page-in .2s ease both; }
@keyframes page-in { from { opacity: .35; transform: translateY(5px); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-heading h1 { font-size: clamp(29px, 8.4vw, 42px); letter-spacing: -1.5px; line-height: 1; font-weight: 1000; }
.eyebrow { display: block; margin-bottom: 5px; color: #078fd9; font-size: 10px; font-weight: 1000; letter-spacing: 1.2px; }
.text-link { min-height: 44px; padding: 8px 0 8px 8px; color: #058ae2; background: transparent; font-size: 12px; font-weight: 900; white-space: nowrap; }
.search-button { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: #0a2b51; border: 1px solid #c7def0; background: white; font-size: 24px; }
.demo-notice { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin: -4px 0 16px; padding: 10px 12px; color: #1c5681; border: 1px solid #c4e6f8; background: var(--ice); border-radius: 12px; font-size: 11px; }
.demo-notice b { color: #087cc5; }
.section-intro { max-width: 620px; margin: -5px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.55; }

.reward-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.home-grid {
  grid-auto-flow: column;
  grid-template-columns: none;
  grid-auto-columns: minmax(148px, 45%);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline mandatory;
  scrollbar-width: none;
  margin-inline: -17px;
  padding: 2px 17px 10px;
}
.home-grid::-webkit-scrollbar { display: none; }
.home-grid .reward-card { scroll-snap-align: start; }
.reward-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 7px 19px rgba(6,53,91,.08);
}
.reward-visual { position: relative; height: 128px; margin: 7px 7px 0; overflow: hidden; border-radius: 12px; background: linear-gradient(145deg, #eff9ff, #dff1fb); }
.reward-visual::after { content: ""; position: absolute; inset: auto 8% 5px; height: 18px; border-radius: 50%; background: rgba(7,99,160,.11); filter: blur(7px); }
.reward-visual img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.demo-badge { position: absolute; z-index: 3; left: 5px; top: 5px; padding: 4px 7px; border-radius: 20px; color: white; background: var(--blue); font-size: 8px; font-weight: 1000; letter-spacing: .4px; box-shadow: 0 2px 5px rgba(0,72,132,.2); }
.reward-info { display: flex; flex: 1; flex-direction: column; align-items: stretch; padding: 9px 8px 10px; text-align: center; }
.reward-info h3 { min-height: 34px; display: grid; place-items: center; color: var(--ink); font-size: 14px; line-height: 1.12; letter-spacing: -.35px; font-weight: 1000; overflow-wrap: anywhere; }
.gift-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 13px;
  color: #172b3d;
  background: linear-gradient(180deg, #ffdc52, var(--yellow));
  box-shadow: inset 0 1px white, 0 3px 0 var(--yellow-deep);
  font-size: 11px;
  font-weight: 1000;
  transition: transform .15s ease, box-shadow .15s ease;
}
.gift-button:active { transform: translateY(2px); box-shadow: inset 0 1px white, 0 1px 0 var(--yellow-deep); }
.gift-button:disabled { cursor: default; color: #5f7183; background: linear-gradient(180deg, #e4edf2, #cbd9e1); box-shadow: inset 0 1px white, 0 3px 0 #adbec8; transform: none; }
.reward-card.is-opened { border-color: #cbd9e1; background: #f5f8fa; box-shadow: 0 5px 14px rgba(6,53,91,.05); }
.reward-card.is-opened .reward-visual img { opacity: .48; filter: grayscale(.65); }
.reward-card.is-opened .reward-info h3 { color: #68798a; }
.reward-count { display: block; min-height: 27px; padding: 9px 3px 0; color: #788ba6; font-size: 9px; line-height: 1.2; }

.filters { display: flex; gap: 8px; overflow-x: auto; margin: 3px 0 18px; padding-bottom: 3px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { min-width: 74px; min-height: 42px; padding: 9px 16px; border-radius: 16px; color: var(--ink); background: #e9f0f6; font-size: 12px; font-weight: 900; white-space: nowrap; }
.filter.active { color: white; background: linear-gradient(135deg, #06aaf8, #078ced); box-shadow: 0 5px 13px rgba(7,145,232,.24); }
.status-card { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 13px; border: 1px solid #dcebf5; border-radius: 15px; background: white; box-shadow: 0 5px 16px rgba(5,54,92,.05); }
.status-dot { width: 12px; height: 12px; flex: 0 0 12px; border-radius: 50%; background: #16c991; box-shadow: 0 0 0 5px #16c9911f; }
.status-card > div { min-width: 0; flex: 1; }
.status-card b, .status-card small { display: block; }
.status-card b { font-size: 12px; }
.status-card small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.status-pill { padding: 6px 8px; border-radius: 20px; color: #0877ba; background: #e6f7ff; font-size: 8px; font-weight: 1000; }
.empty-state { grid-column: 1 / -1; display: grid; place-items: center; min-height: 250px; padding: 25px; text-align: center; border: 1px dashed #bedbe9; border-radius: 18px; background: #f2faff; }
.empty-icon { font-size: 40px; }
.empty-state h3 { margin-top: 8px; font-size: 18px; }
.empty-state p { max-width: 390px; margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.empty-state a { margin-top: 14px; color: #078ce2; font-size: 12px; font-weight: 900; }

.settings-grid { display: grid; gap: 11px; }
.settings-card { display: flex; align-items: flex-start; gap: 13px; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: white; box-shadow: 0 6px 17px rgba(5,50,88,.06); }
.settings-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; color: white; border-radius: 13px; background: linear-gradient(145deg, var(--blue), #0868c6); font-size: 20px; }
.settings-card h2 { font-size: 15px; }
.settings-card p { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.settings-card a { display: inline-block; margin-top: 8px; color: #0789dd; font-size: 11px; font-weight: 900; }
.secondary-button { min-height: 42px; margin-top: 11px; padding: 9px 15px; border-radius: 12px; color: #086eb4; border: 1px solid #a9d8ef; background: #eefaff; font-weight: 900; font-size: 11px; }

.bottom-nav {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 620px);
  min-height: calc(82px + env(safe-area-inset-bottom));
  margin: auto;
  padding: 8px 10px env(safe-area-inset-bottom);
  background: rgba(4,39,73,.98);
  box-shadow: 0 -8px 24px rgba(5,43,78,.18);
}
.bottom-link { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #d6e4f3; border-radius: 17px; background: transparent; font-size: 11px; }
.bottom-link .nav-icon { width: 27px; height: 27px; }
.bottom-link b { font-size: 10px; }
.bottom-link.active { color: white; background: linear-gradient(145deg, #0ca7f6, #076cc3); box-shadow: inset 0 1px #46d4ff, 0 6px 14px rgba(0,12,39,.24); }

.reward-dialog { width: min(90vw, 430px); max-height: 88dvh; margin: auto; padding: 23px; overflow: auto; text-align: center; color: var(--ink); border: 0; border-radius: 24px; background: white; box-shadow: 0 24px 80px rgba(1,20,42,.44); }
.reward-dialog::backdrop { background: rgba(2,20,40,.73); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; z-index: 2; top: 12px; right: 12px; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); background: #eaf6fd; font-size: 25px; }
.dialog-art { height: 195px; margin: 7px 0 18px; border-radius: 18px; background: linear-gradient(145deg, #edf9ff, #dceff9); }
.dialog-art img { width: 100%; height: 100%; object-fit: contain; }
.reward-dialog h2 { margin-top: 5px; font-size: 27px; letter-spacing: -1px; }
.reward-dialog > p { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dialog-count { display: block; margin-top: 13px; color: #087abb; font-size: 12px; }
.reward-dialog .gift-button { margin-top: 18px; min-height: 49px; font-size: 13px; }
.reward-dialog .secondary-button { width: 100%; }

@media (max-width: 359px) {
  .mobile-hero { height: 350px; }
  .hero-copy { top: 122px; }
  .hero-copy h1 { font-size: 34px; }
  .hero-captain { width: 70%; right: -45px; }
  .content { min-height: calc(100dvh - 350px); padding-inline: 12px; }
  .home-grid { margin-inline: -12px; padding-inline: 12px; grid-auto-columns: 47%; }
  .reward-visual { height: 116px; }
  .gift-button { padding-inline: 5px; font-size: 10px; }
}

@media (min-width: 560px) and (max-width: 759px) {
  .app-shell { max-width: 620px; margin: auto; box-shadow: 0 0 45px rgba(2,28,52,.23); }
  .hero-captain { right: 1%; width: 305px; }
  .hero-copy { left: 35px; }
  .content { padding-inline: 25px; }
  .home-grid { margin-inline: -25px; padding-inline: 25px; grid-auto-columns: 185px; }
  .reward-grid:not(.home-grid) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 760px) {
  body {
    min-height: 100dvh;
    padding: 0;
    background:
      linear-gradient(rgba(3,24,48,.28), rgba(3,24,48,.48)),
      url('./assets/hafen.webp') center / cover fixed;
  }
  .app-shell {
    display: grid;
    grid-template-columns: clamp(178px, 21vw, 238px) minmax(0, 1fr);
    width: 100%;
    max-width: 1180px;
    min-height: 100dvh;
    margin: auto;
    box-shadow: 0 0 70px rgba(0,17,38,.35);
  }
  .sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding: 35px 16px 24px;
    overflow: hidden;
    color: white;
    background: linear-gradient(180deg, #073257, var(--navy-deep));
  }
  .brand-sidebar { justify-content: center; font-size: 25px; }
  .side-nav { position: relative; z-index: 2; display: grid; gap: 8px; margin-top: 70px; }
  .side-link { display: flex; align-items: center; gap: 13px; min-height: 54px; padding: 10px 15px; color: #e0ecf7; border-radius: 14px; background: transparent; text-align: left; font-size: 14px; }
  .side-link .nav-icon { width: 29px; font-size: 25px; text-align: center; }
  .side-link.active { color: white; background: linear-gradient(135deg, #0ca9f5, #0873d3); box-shadow: inset 0 1px #57ddff, 0 8px 19px rgba(0,13,39,.2); font-weight: 900; }
  .sidebar-waves { position: absolute; left: 0; right: 0; bottom: 70px; height: 120px; opacity: .5; background: radial-gradient(ellipse at 20% 100%, #1675bf 0 30%, transparent 31%), radial-gradient(ellipse at 63% 100%, #0a528e 0 34%, transparent 35%); }
  .sidebar-note { position: relative; z-index: 2; margin-top: auto; color: #a9c4de; font-size: 10px; line-height: 1.5; }
  .stage { display: flex; flex-direction: column; }
  .mobile-hero, .bottom-nav { display: none !important; }
  .tablet-banner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 176px;
    overflow: hidden;
    background:
      linear-gradient(90deg, rgba(12,129,195,.35), rgba(255,255,255,.05)),
      url('./assets/hafen.webp') center 48% / cover no-repeat;
  }
  .tablet-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5,42,76,.5), transparent 60%); }
  .tablet-banner img { position: absolute; z-index: 2; left: clamp(3%, 7vw, 10%); bottom: 0; width: 170px; filter: drop-shadow(0 6px 12px rgba(0,30,60,.38)); }
  .captain-message { position: relative; z-index: 3; min-width: 205px; margin-left: 92px; padding: 13px 22px; color: #1a4a78; border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: 0 5px 17px rgba(2,57,95,.13); font-size: 14px; line-height: 1.15; }
  .tablet-banner .refresh { position: absolute; z-index: 4; right: 24px; top: 50%; transform: translateY(-50%); }
  .tablet-banner .refresh.working { animation: none; }
  .tablet-banner .refresh.working .button-icon { animation: spin .8s linear infinite; }
  .content, .app-shell:not([data-page="start"]) .content {
    flex: 1;
    min-height: calc(100dvh - 176px);
    margin: 0;
    padding: 34px clamp(22px, 4vw, 46px) 48px;
    border-radius: 28px 0 0 0;
    background: #fbfdff;
  }
  .page-heading { align-items: center; margin-bottom: 18px; }
  .page-heading h1 { font-size: clamp(38px, 4.2vw, 52px); }
  .start-heading .eyebrow { display: none; }
  .text-link { font-size: 13px; }
  .home-grid, .reward-grid {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-columns: auto;
    gap: 13px;
    overflow: visible;
    margin: 0;
    padding: 0;
  }
  .reward-visual { height: 150px; }
  .reward-info { padding: 10px 9px 12px; }
  .reward-info h3 { font-size: 16px; }
  .gift-button { min-height: 43px; font-size: 11px; }
  .reward-count { font-size: 10px; }
  .filters { margin-bottom: 16px; }
  .filter { min-width: 110px; }
  .status-card { max-width: 700px; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
  .reward-dialog { width: min(480px, 70vw); }
}

@media (min-width: 760px) and (max-width: 899px) {
  .app-shell { grid-template-columns: 164px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .brand-sidebar { font-size: 19px; letter-spacing: -1.2px; }
  .brand-sidebar .brand-anchor { margin-right: 5px; }
  .side-link { gap: 8px; padding-inline: 10px; font-size: 12px; }
  .side-link .nav-icon { width: 24px; font-size: 22px; }
  .tablet-banner img { width: 154px; }
  .content, .app-shell:not([data-page="start"]) .content { padding-inline: 20px; }
  .reward-grid, .home-grid { gap: 9px; }
  .reward-visual { height: 132px; }
  .gift-button { padding-inline: 5px; font-size: 10px; }
}

@media (min-width: 1040px) {
  body { padding-block: 26px; }
  .app-shell { max-width: 1440px; min-height: calc(100dvh - 52px); border-radius: 27px; }
  .sidebar { min-height: calc(100dvh - 52px); border-radius: 27px 0 0 27px; }
  .stage { min-height: calc(100dvh - 52px); overflow: hidden; border-radius: 0 27px 27px 0; }
  .content, .app-shell:not([data-page="start"]) .content { min-height: calc(100dvh - 228px); }
  .reward-visual { height: 160px; }
}

@media (min-width: 1280px) {
  .home-grid, .reward-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .content, .app-shell:not([data-page="start"]) .content { padding-inline: clamp(40px, 5vw, 70px); }
}

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