/* 漂流瓶 · Drift Bottle — base styles */
:root {
  --deep: #04121f;
  --sea: #0b2b45;
  --sea-2: #10405f;
  --foam: #d9f1ff;
  --sand: #f4e4c8;
  --ink: #0a1a26;
  --accent: #67e8d5;
  --accent-2: #8ab6ff;
  --warn: #ffb86b;
  --glass: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.16);
  --radius: 18px;
  --shadow: 0 18px 40px rgba(0, 12, 24, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(120% 80% at 50% 0%, #123c58 0%, #071c2c 45%, #04121f 100%);
  color: var(--foam);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

#ocean {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: env(safe-area-inset-top) 14px env(safe-area-inset-bottom);
  overflow: hidden;
}

/* header */
.top {
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 4px 10px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.brand small {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(217, 241, 255, 0.55);
}

.stat {
  font-size: 11.5px;
  color: rgba(217, 241, 255, 0.72);
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px 12px;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

/* main stage */
.stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.view { animation: rise 0.42s cubic-bezier(0.22, 0.9, 0.3, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* card */
.card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 18px;
  max-height: 100%;
  overflow: auto;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: 0.04em;
}

.card-sub {
  font-size: 12px;
  color: rgba(217, 241, 255, 0.6);
  margin: 0 0 14px;
  line-height: 1.6;
}

/* inputs */
textarea, input {
  width: 100%;
  font: inherit;
  color: var(--foam);
  background: rgba(4, 18, 31, 0.45);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: none;
}

textarea::placeholder, input::placeholder { color: rgba(217, 241, 255, 0.35); }

textarea:focus, input:focus {
  border-color: rgba(103, 232, 213, 0.7);
  box-shadow: 0 0 0 3px rgba(103, 232, 213, 0.14);
}

.counter {
  text-align: right;
  font-size: 11px;
  color: rgba(217, 241, 255, 0.45);
  margin: 6px 2px 0;
}

.counter.over { color: var(--warn); }

/* mood chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}

.chip {
  font: inherit;
  font-size: 12px;
  color: rgba(217, 241, 255, 0.8);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, color 0.2s;
}

.chip:active { transform: scale(0.95); }

.chip.on {
  color: #04202c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  font-weight: 600;
}

/* buttons */
.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #04202c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 13px;
  padding: 13px 18px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.15s, filter 0.2s, opacity 0.2s;
  box-shadow: 0 10px 26px rgba(103, 232, 213, 0.22);
}

.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn.ghost {
  background: rgba(255, 255, 255, 0.07);
  color: var(--foam);
  border: 1px solid var(--stroke);
  box-shadow: none;
  font-weight: 500;
}

.btn.small {
  width: auto;
  padding: 9px 15px;
  font-size: 12.5px;
  border-radius: 11px;
}

.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; }

/* bottle letter */
.letter {
  position: relative;
  background: linear-gradient(155deg, #fdf7ea, #f3e6cf);
  color: var(--ink);
  border-radius: 14px;
  padding: 20px 18px 16px;
  box-shadow: 0 14px 30px rgba(0, 10, 20, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  line-height: 1.75;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 42vh;
  overflow: auto;
}

.letter::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(10, 26, 38, 0.14);
  border-radius: 9px;
  pointer-events: none;
}

.letter .meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: rgba(10, 26, 38, 0.5);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.letter.flip { animation: letterIn 0.5s cubic-bezier(0.22, 0.9, 0.3, 1) both; }
@keyframes letterIn {
  from { opacity: 0; transform: rotate(-3deg) translateY(18px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

/* nav */
.nav {
  width: 100%;
  max-width: 560px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 6px calc(12px + env(safe-area-inset-bottom));
  margin-top: 10px;
  background: linear-gradient(to top, rgba(4, 18, 31, 0.7), transparent);
}

.nav button {
  font: inherit;
  font-size: 12px;
  color: rgba(217, 241, 255, 0.6);
  background: none;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 10px 4px 9px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.nav button span.ico { font-size: 17px; line-height: 1; }
.nav button.on {
  color: var(--accent);
  background: rgba(103, 232, 213, 0.09);
  border-color: rgba(103, 232, 213, 0.28);
}

/* mini list */
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

.item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  border-radius: 13px;
  padding: 12px 13px;
  font-size: 13px;
  line-height: 1.6;
}

.item .head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: rgba(217, 241, 255, 0.55);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.item .body { color: rgba(240, 250, 255, 0.9); word-break: break-word; }
.item .reply {
  margin-top: 9px;
  padding-left: 10px;
  border-left: 2px solid rgba(103, 232, 213, 0.45);
  font-size: 12.5px;
  color: rgba(217, 241, 255, 0.78);
}

.tag {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(138, 182, 255, 0.18);
  color: #bcd4ff;
  white-space: nowrap;
}

.empty {
  text-align: center;
  padding: 26px 10px;
  font-size: 12.5px;
  color: rgba(217, 241, 255, 0.5);
  line-height: 1.9;
}

.empty .big { display: block; font-size: 30px; margin-bottom: 6px; opacity: 0.7; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translate(-50%, 18px);
  z-index: 40;
  max-width: 84vw;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--foam);
  background: rgba(10, 32, 48, 0.92);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s, transform 0.28s;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* splash seal */
.seal {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: rgba(217, 241, 255, 0.35);
  text-align: center;
  margin-top: 10px;
}

::-webkit-scrollbar { width: 0; height: 0; }
