:root {
  --ink: #f2e8d5;
  --ink-dim: #b7c4cf;
  --sea: #0b1c2c;
  --sea-mid: #14324a;
  --foam: #3db8a0;
  --foam-deep: #2a8f7c;
  --warn: #e8a54b;
  --danger: #e06b6b;
  --ok: #5dce8a;
  --line: rgba(242, 232, 213, 0.12);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a4a63 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1f3d2e 0%, transparent 45%),
    linear-gradient(180deg, #0b1c2c 0%, #08141f 100%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
}

button,
input,
select {
  font: inherit;
}

.app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 1.1rem 1rem 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem 0.2rem 0.2rem;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 6vw, 2.25rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.brand p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.95rem;
}

.panel {
  background: color-mix(in srgb, var(--sea-mid) 88%, black);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field label {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: color-mix(in srgb, var(--foam) 70%, white);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(180deg, var(--foam), var(--foam-deep));
  color: #04201a;
  font-weight: 700;
  cursor: pointer;
}

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

.btn.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.danger {
  background: linear-gradient(180deg, #ef8585, #c44f4f);
  color: #2a0b0b;
}

.sailing-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sailing {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.9rem;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  text-align: left;
  color: inherit;
  width: 100%;
}

.sailing.selected {
  border-color: color-mix(in srgb, var(--foam) 65%, white);
  background: rgba(61, 184, 160, 0.12);
}

.sailing .route {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.sailing .meta {
  color: var(--ink-dim);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
}

.pass {
  text-align: center;
}

.pass .status {
  display: inline-block;
  margin-bottom: 0.7rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status.issued {
  background: rgba(61, 184, 160, 0.2);
  color: var(--foam);
}

.status.boarded {
  background: rgba(224, 107, 107, 0.2);
  color: var(--danger);
}

.status.cancelled {
  background: rgba(183, 196, 207, 0.15);
  color: var(--ink-dim);
}

.qr-frame {
  margin: 0.4rem auto 0.9rem;
  width: min(72vw, 260px);
  aspect-ratio: 1;
  border-radius: 18px;
  background: #fff;
  padding: 0.7rem;
  display: grid;
  place-items: center;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pass .passenger {
  font-family: var(--font-display);
  font-size: 1.45rem;
  margin: 0.2rem 0;
}

.pass .detail {
  color: var(--ink-dim);
  margin: 0.2rem 0;
  font-size: 0.95rem;
}

.pass .code {
  margin-top: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  font-size: 0.85rem;
}

#reader {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #000;
}

#reader video {
  border-radius: 14px !important;
}

.scan-result {
  margin-top: 0.9rem;
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.scan-result.accepted {
  border-color: color-mix(in srgb, var(--ok) 55%, white);
  background: rgba(93, 206, 138, 0.12);
}

.scan-result.rejected {
  border-color: color-mix(in srgb, var(--danger) 55%, white);
  background: rgba(224, 107, 107, 0.12);
}

.scan-result h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
}

.scan-result p {
  margin: 0.2rem 0;
  color: var(--ink-dim);
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.ticket-row:last-child {
  border-bottom: 0;
}

.ticket-row button {
  border: 0;
  background: transparent;
  color: var(--foam);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.nav {
  position: fixed;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  width: min(460px - 2rem, calc(100% - 1.5rem));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(8, 20, 31, 0.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.nav button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  padding: 0.75rem 0.4rem;
  font-weight: 700;
  cursor: pointer;
}

.nav button.active {
  background: rgba(61, 184, 160, 0.18);
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  top: 0.85rem;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(420px, calc(100% - 1.5rem));
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #14324a;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.empty {
  color: var(--ink-dim);
  text-align: center;
  padding: 1rem 0.5rem;
}

@media (min-width: 720px) {
  .app {
    padding-top: 1.6rem;
  }
}
