:root {
  --bg-1: #eaf2ff;
  --bg-2: #f6f9ff;
  --ink: #10233f;
  --primary: #1d4d8f;
  --primary-2: #2d67b3;
  --neutral: #37557e;
  --danger: #b54a17;
  --accent-warm: #f4c542;
  --panel: #ffffff;
  --hero-image-mobile: url("/static/header-hero-mobile.jpg");
  --hero-image-desktop: url("/static/header-hero.jpg");
  --hero-image: var(--hero-image-mobile);
}

* { box-sizing: border-box; }

.no-wrap {
  white-space: nowrap;
}

html,
body {
  min-height: 100%;
}

html.splash-open,
body.splash-open {
  overflow: hidden;
  overscroll-behavior: none;
}

html.tip-modal-open,
body.tip-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

html {
  height: 100%;
  background-color: #10233f;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  background-color: #10233f;
  background:
    radial-gradient(circle at 8% 0%, rgba(31, 86, 176, 0.25), transparent 42%),
    radial-gradient(circle at 92% 14%, rgba(244, 197, 66, 0.22), transparent 36%),
    linear-gradient(150deg, var(--bg-1), var(--bg-2));
  background-repeat: no-repeat;
  background-size: cover;
  overscroll-behavior-y: none;
}

.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 14px calc(76px + env(safe-area-inset-bottom));
}

.desktop-landing {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

.desktop-hero {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(18, 42, 76, 0.5), rgba(26, 74, 141, 0.34)),
    var(--hero-image-desktop, var(--hero-image, url("/static/header-hero.jpg"))) top center / cover no-repeat;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 64px);
}

.desktop-message {
  max-width: 960px;
  color: #f7fbff;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  backdrop-filter: none;
  text-shadow: 0 4px 16px rgba(8, 22, 45, 0.66);
}

.desktop-message h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4.2vw, 3.6rem);
  line-height: 1.08;
}

.desktop-message p {
  margin: 0 0 14px;
  line-height: 1.5;
  font-size: clamp(1rem, 1.42vw, 1.3rem);
  max-width: 900px;
}

.desktop-message p:last-child {
  margin-bottom: 0;
}

.desktop-message a {
  display: inline;
  padding: 0.04em 0.18em;
  border-radius: 6px;
  background: rgba(252, 191, 71, 0.22);
  color: #ffe7a7;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-shadow: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.desktop-message a:hover {
  color: #fff2c6;
  background: rgba(252, 191, 71, 0.3);
}

.desktop-message a:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.desktop-tipjar {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 28px) clamp(14px, 3vw, 24px) calc(30px + env(safe-area-inset-bottom));
}

.hero {
  min-height: 230px;
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(23, 58, 106, 0.78), rgba(31, 86, 176, 0.55)),
    var(--hero-image, var(--hero-image-mobile, url("/static/header-hero-mobile.jpg"))) top center / cover no-repeat;
  color: #f8fffc;
  box-shadow: 0 10px 28px rgba(16, 45, 57, 0.22);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero h1 {
  margin: 6px 0 4px;
  font-size: 1.55rem;
}

.hero p {
  margin: 0;
  opacity: 0.95;
  max-width: 680px;
  line-height: 1.4;
}

.hero a {
  color: #ffd86a;
}

#install-landing .hero h2 {
  margin-top: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid #d8e2f3;
  border-radius: 16px;
  padding: 14px;
  margin: 10px 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}

.panel.contact-alert {
  background: #fff0f0;
  border-color: #f0b3b3;
}

.update-banner {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff5d4;
  color: #6b4f00;
  border: 1px solid #f0cf74;
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 6px 16px rgba(30, 40, 70, 0.08);
}

.update-now-btn {
  white-space: nowrap;
  padding: 8px 12px;
}

h2 {
  margin: 0 0 8px;
  font-size: 1.07rem;
}

.hint {
  margin-top: 0;
  color: #4b6287;
}

.install-steps {
  margin: 8px 0 12px 20px;
  color: #365274;
}

.install-steps li {
  margin-bottom: 6px;
}

.install-steps-media {
  margin: 8px 0 0 20px;
  display: grid;
  gap: 14px;
}

.install-steps-media li {
  margin: 0;
}

.install-step-title {
  margin: 0 0 10px;
  color: #1f3c63;
  line-height: 1.4;
}

.install-gallery {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

#install-ios .install-gallery {
  grid-template-columns: 1fr;
}

.install-shot {
  margin: 0;
  background: #f7fbff;
  border: 1px solid #d4e0f2;
  border-radius: 12px;
  overflow: hidden;
}

.install-shot img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  background: #eef4fe;
}

.install-shot figcaption {
  padding: 10px 12px 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  font-weight: 600;
  color: #1e3c63;
  background: #ffffff;
  border-top: 1px solid #c8d8ee;
  letter-spacing: 0.01em;
}

.install-shot-screen {
  position: relative;
  margin-top: 0;
  max-width: 460px;
  background: linear-gradient(160deg, #122646, #1c3f72);
  border-color: #2f5080;
  border-width: 2px;
  box-shadow: 0 14px 32px rgba(12, 30, 58, 0.34);
  padding: 8px;
}

.install-shot-screen::before {
  content: "Screenshot";
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(202, 220, 246, 0.7);
  background: rgba(9, 24, 47, 0.74);
  color: #f3f8ff;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.install-shot-screen img {
  border-radius: 8px;
  border: 1px solid #6381ab;
  background: #ffffff;
}

.install-shot-screen figcaption {
  padding: 8px 4px 4px;
  border-top: 0;
  background: transparent;
  color: #e5efff;
  font-size: 0.8rem;
  text-align: right;
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  font-size: 0.9rem;
  margin-bottom: 6px;
}

input {
  width: 100%;
  border: 1px solid #bed0ec;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 1rem;
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  border: 1px solid #bed0ec;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 1rem;
  margin-bottom: 10px;
  resize: vertical;
  min-height: 140px;
  font-family: inherit;
}

.login-options {
  margin: 10px 0 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
  font-size: clamp(0.82rem, 2.7vw, 0.95rem);
  flex-wrap: nowrap;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.checkbox-label-text {
  white-space: nowrap;
}

.password-field-wrap {
  margin-top: 0;
}

button {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 11px 13px;
  color: #fff;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary { background: var(--primary); }
button.primary:hover { background: var(--primary-2); }
button.neutral { background: var(--neutral); }
button.danger { background: var(--danger); }
button.neutral:hover { background: #466892; }
button.danger:hover { background: #c95a24; }

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.action-grid > button {
  width: 100%;
}

.link-btn {
  appearance: none;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  margin-top: 12px;
  background: #f4f8ff;
  color: #245892;
  border: 1px solid #c2d4eb;
}

.inline-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.link-btn:hover {
  background: #e7f0ff;
}

.full-width-btn {
  width: 100%;
}

.unlink-btn {
  width: 100%;
  max-width: 100%;
}

.tip-fab {
  position: fixed;
  left: calc(14px + env(safe-area-inset-left));
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 2300;
  border-radius: 999px;
  background: #fcbf47;
  color: #323842;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
  padding: 10px 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.tip-fab:hover {
  background: #ffcf68;
}

.tip-modal {
  position: fixed;
  inset: 0;
  z-index: 2350;
  background: rgba(22, 35, 56, 0.56);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.tip-modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #fcbf47;
  color: #323842;
  border: 1px solid #f2ad2b;
  border-radius: 18px;
  box-shadow: 0 22px 44px rgba(12, 20, 34, 0.35);
  padding: 18px 16px 16px;
  position: relative;
}

.tip-modal-card h2 {
  margin: 0 0 10px;
  color: #2f3034;
}

.tip-modal-text {
  margin: 0 0 14px;
  color: #323842;
  line-height: 1.45;
}

.tip-modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #d89d2b;
  background: #ffe8a8;
  color: #323842;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  padding: 0;
}

.tip-modal-close:hover {
  background: #ffdf8a;
}

.tip-purpose-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.tip-purpose-btn {
  border-radius: 12px;
  border: 1px solid #d9a23e;
  background: #ffe8a8;
  color: #323842;
  font-weight: 700;
  padding: 10px 8px;
}

.tip-purpose-btn.is-active {
  border-color: #b57d1a;
  background: #f9d16a;
  box-shadow: 0 0 0 2px rgba(181, 125, 26, 0.22);
}

.tip-amount-label {
  display: block;
  margin: 0 0 6px;
  color: #323842;
  font-weight: 700;
}

.tip-amount-range {
  width: 100%;
  margin-bottom: 14px;
  accent-color: #b57d1a;
}

.session {
  margin-top: 0;
  color: #375a84;
  font-size: 0.93rem;
}

.status-box {
  background: #142d4e;
  color: #e7f0ff;
  border-radius: 12px;
  padding: 12px;
  min-height: 80px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.tip {
  margin-top: 14px;
  color: #4d617a;
  font-size: 0.92rem;
  border-left: 4px solid var(--accent-warm);
  padding-left: 10px;
}

.onboarding-hint {
  margin-top: 10px;
  margin-bottom: 0;
}

.radio-group {
  margin: 10px 0;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.radio-row input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.contact-filter {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.contact-filter-btn {
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.86rem;
  font-weight: 700;
}

.contact-filter-btn.is-active {
  background: var(--primary);
  color: #ffffff;
}

.admin-logout-btn {
  min-width: 100px;
}

.admin-list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.contact-admin-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.contact-refresh-btn {
  margin-top: 12px;
}

.contact-feedback-item {
  width: 100%;
  text-align: left;
  background: #f9fbff;
  color: #1f3b61;
  border: 1px solid #d6e1f2;
  border-radius: 12px;
  padding: 10px;
  font-weight: 600;
}

.contact-feedback-item.is-unread {
  border-color: #f0ca55;
  background: #fff9e8;
}

.contact-feedback-item.is-read {
  border-color: #d6e1f2;
  background: #f9fbff;
}

.contact-feedback-item:hover {
  background: #f2f7ff;
}

.contact-feedback-item.is-active {
  border-color: #7fa6da;
  box-shadow: 0 0 0 2px rgba(49, 98, 173, 0.18);
}

.contact-feedback-item-top {
  font-size: 0.93rem;
  color: #1c3b63;
}

.contact-feedback-status {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  color: #5d4600;
  background: #ffe8a1;
  border: 1px solid #efcb60;
}

.contact-feedback-item.is-read .contact-feedback-status {
  color: #2d567f;
  background: #e8f1ff;
  border-color: #bfd4ef;
}

.contact-feedback-item-meta {
  margin-top: 2px;
  font-size: 0.86rem;
  color: #416086;
}

.contact-feedback-item-preview {
  margin-top: 6px;
  color: #27466d;
  font-size: 0.9rem;
  line-height: 1.4;
}

.contact-admin-detail {
  margin-top: 12px;
  border: 1px solid #d6e1f2;
  border-radius: 14px;
  padding: 12px;
  background: #f9fbff;
}

.contact-admin-detail h3 {
  margin: 0 0 8px;
  color: #1c3b63;
}

.contact-detail-meta {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: #44638a;
  line-height: 1.45;
}

.contact-detail-message {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #d0ddf1;
  background: #ffffff;
  color: #1d3558;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.contact-detail-actions {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-card {
  border: 1px solid #d6e1f2;
  border-radius: 14px;
  padding: 10px;
  background: #f9fbff;
}

.admin-card-info p {
  margin: 0 0 5px;
  color: #2b4669;
  line-height: 1.35;
}

.admin-card-info p:last-child {
  margin-bottom: 0;
}

.admin-card-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.offline-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(112, 122, 138, 0.62);
  backdrop-filter: blur(2px) grayscale(0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pwa-splash {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: calc(var(--app-vh, 1vh) * 100);
  min-height: 100vh;
  z-index: 2400;
  background-color: #10233f;
  background:
    linear-gradient(135deg, rgba(18, 42, 76, 0.56), rgba(26, 74, 141, 0.42)),
    var(--hero-image, var(--hero-image-mobile, url("/static/header-hero-mobile.jpg"))) top center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  color: #f9fcff;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.pwa-splash.is-fading {
  opacity: 0;
}

.pwa-splash-title {
  text-align: center;
  font-weight: 800;
  font-size: clamp(2rem, 8vw, 3.2rem);
  line-height: 1.1;
  text-shadow: 0 4px 16px rgba(8, 22, 45, 0.55);
}

.pwa-splash-center {
  max-width: min(760px, 92vw);
  text-align: center;
}

.pwa-splash-warning {
  margin-top: 16px;
  background: rgba(10, 26, 50, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 14px;
  padding: 12px 12px 10px;
}

.pwa-splash-warning p {
  margin: 0;
  line-height: 1.4;
  font-size: 0.97rem;
}

.pwa-splash-status {
  margin-top: 10px;
  font-size: 0.9rem;
  opacity: 0.9;
}

.pwa-splash-confirm {
  margin-top: 10px;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #11345e;
  background: #f9fbff;
}

.pwa-splash-version {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: min(92vw, 360px);
  text-align: center;
  line-height: 1.25;
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  opacity: 0.9;
  background: rgba(9, 24, 48, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
  z-index: 2;
}

.offline-card {
  max-width: 420px;
  width: 100%;
  background: #f6f8fb;
  border: 1px solid #d4dbe5;
  border-radius: 16px;
  padding: 18px 16px;
  text-align: center;
  color: #34475f;
  box-shadow: 0 18px 44px rgba(20, 34, 51, 0.18);
}

.offline-card h2 {
  margin: 0 0 8px;
  color: #2f435d;
}

.offline-card p {
  margin: 0;
  line-height: 1.45;
}

.ui-version {
  margin-top: 14px;
  margin-left: auto;
  width: fit-content;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: rgba(26, 44, 70, 0.72);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(180, 195, 214, 0.55);
  border-radius: 999px;
  padding: 3px 8px;
  backdrop-filter: blur(2px);
  transition: opacity 0.4s ease;
}

.ui-version.is-fading {
  opacity: 0;
}

.hidden { display: none; }

@media (max-width: 520px) {
  .update-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .update-now-btn { width: 100%; }
  .unlink-btn { max-width: 100%; }
  .action-grid { grid-template-columns: 1fr; }
  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .contact-filter {
    width: 100%;
    justify-content: stretch;
  }
  .contact-filter-btn {
    flex: 1 1 0;
  }
  .admin-card-actions {
    grid-template-columns: 1fr;
  }
  .contact-detail-actions {
    grid-template-columns: 1fr;
  }
  .tip-purpose-group {
    grid-template-columns: 1fr;
  }
}

@supports (-webkit-touch-callout: none) {
  html {
    height: -webkit-fill-available;
  }

  body {
    min-height: -webkit-fill-available;
  }
}
