/* For My Sydie - quiet, modern interface so the character art stays the hero */
:root {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text: #F4EEE6;                      /* warm off-white */
  --text-2: rgba(244, 238, 230, 0.68);  /* secondary */
  --text-3: rgba(244, 238, 230, 0.42);  /* tertiary */
  --accent: #FFAB40;                    /* used sparingly */
  --glass: rgba(14, 14, 16, 0.62);
  --hairline: rgba(255, 255, 255, 0.09);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #000; color: var(--text);
  font-family: var(--sans); font-weight: 400; overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font-family: var(--sans); }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---- navigation: two quiet words over the night sky ---- */
.tabs {
  position: absolute; z-index: 20; top: env(safe-area-inset-top, 0px); left: 0; right: 0;
  display: flex; justify-content: center; gap: 18px; padding: 10px 52px 0;
  pointer-events: none;
}
.tab-btn {
  position: relative; pointer-events: auto; background: none; border: 0; border-radius: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; box-shadow: none;
  color: var(--text-3); font-size: 13px; font-weight: 400; letter-spacing: 0.02em;
  padding: 8px 2px 10px; transition: color .4s ease, text-shadow .4s ease;
}
.tab-btn:hover { color: var(--text-2); }
/* never a box or pill: no focus outline after tapping */
.tab-btn:focus, .tab-btn:focus-visible, .menu-btn:focus, .snack:focus, .water-btn:focus, .intro-skip:focus { outline: none; }
.menu-btn:focus-visible, .snack:focus-visible, .water-btn:focus-visible { outline: 1px solid rgba(244, 238, 230, 0.25); outline-offset: 4px; border-radius: 8px; }
.tab-btn:focus-visible { color: var(--text-2); }
/* active: simply brighter, with a whisper of warm glow and a fine underline */
.tab-btn.active { color: var(--text); text-shadow: 0 0 12px rgba(255, 200, 140, 0.18); }
.tab-btn::after {
  content: ''; position: absolute; left: 50%; bottom: 3px; width: 14px; height: 1px;
  background: linear-gradient(90deg, rgba(255, 171, 64, 0), var(--accent), rgba(255, 171, 64, 0));
  box-shadow: 0 0 5px rgba(255, 171, 64, 0.35);
  transform: translateX(-50%) scaleX(0); opacity: 0; transition: transform .4s ease, opacity .4s ease;
}
.tab-btn.active::after { transform: translateX(-50%) scaleX(1); opacity: 0.9; }

/* ---- pages ---- */
.tab-page { position: absolute; inset: 0; display: none; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.tab-page.active { display: flex; }
.stage { position: relative; flex: 1 1 auto; min-height: 0; touch-action: none; overflow: hidden; }
.layer { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

/* ---- captions under the artwork ---- */
/* a quiet signature line: a tiny warm hairline, then the words in a narrow, airy measure */
.caption {
  flex: 0 0 auto; margin: 0 auto; width: 100%; max-width: 340px;
  padding: 14px 30px calc(22px + env(safe-area-inset-bottom, 0px));
  text-align: center; font-size: 13px; font-weight: 400; line-height: 1.7; letter-spacing: 0.012em; color: var(--text-2);
  background: #000; opacity: 0; transition: opacity 1.6s ease;
  text-wrap: balance;
}
.caption::before {
  content: ''; display: block; width: 18px; height: 1px; margin: 0 auto 13px;
  background: linear-gradient(90deg, rgba(255, 171, 64, 0), rgba(255, 171, 64, 0.75), rgba(255, 171, 64, 0));
}
.caption.show, .caption-garden { opacity: 1; }
.caption p { margin: 0; }
.caption .counter {
  margin-top: 9px; font-size: 11px; font-weight: 500; letter-spacing: 0.07em;
  color: var(--text-3); font-variant-numeric: tabular-nums;
}
.caption .counter::before {
  content: ''; display: inline-block; width: 4px; height: 4px; margin: 0 8px 2px 0; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 6px rgba(255, 171, 64, 0.8); vertical-align: middle;
}

/* ---- controls: small glass pills ---- */
.snack, .water-btn {
  position: absolute; z-index: 5; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 7px;
  background: var(--glass); border: 1px solid var(--hairline); border-radius: 999px;
  color: var(--text-2); font-size: 12px; font-weight: 500; letter-spacing: 0.01em;
  padding: 6px 13px 6px 7px; cursor: pointer; touch-action: none;
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: border-color .3s ease, color .3s ease;
}
.snack:active, .water-btn:active { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.kiwi-icon { width: 22px; height: 22px; }
/* the watering can is drawn in the garden scene itself (character art); this button only
   sits invisibly over its resting place for keyboard users (touches go to the scene) */
.water-btn {
  width: 84px; height: 56px; right: 6px; bottom: 14px; padding: 0;
  background: none; border: 0; opacity: 0; pointer-events: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.water-btn:focus-visible { opacity: 1; outline: 1px solid rgba(244, 238, 230, 0.25); outline-offset: 2px; border-radius: 14px; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
/* the garden tab glowing softly when the shark says "come see your garden!" */
.tab-btn.pulse { animation: tabGlow 1.6s ease-in-out infinite; box-shadow: none; }
@keyframes tabGlow {
  0%, 100% { color: rgba(244, 238, 230, 0.55); text-shadow: none; }
  50% { color: #FFD9A0; text-shadow: 0 0 10px rgba(255, 171, 64, 0.75); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 171, 64, 0); border-color: var(--hairline); }
  50% { box-shadow: 0 0 0 5px rgba(255, 171, 64, 0.10), 0 0 16px rgba(255, 171, 64, 0.22); border-color: rgba(255, 171, 64, 0.45); }
}

/* ---- opening ---- */
.intro {
  position: absolute; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center;
  background: #000; transition: background 1.2s ease;
}
.intro.show { display: flex; }
.intro.clear { background: transparent; pointer-events: none; }
.intro-line {
  margin: 0 32px; font-size: 19px; font-weight: 400; line-height: 1.45; letter-spacing: 0.005em;
  color: var(--text); text-align: center;
  opacity: 0; transform: translateY(6px); transition: opacity 1.4s ease, transform 1.8s ease;
}
.intro-line.show { opacity: 1; transform: none; }
.intro-skip {
  position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); pointer-events: auto;
  background: none; border: 0; color: var(--text-3); font-size: 12px; font-weight: 500; letter-spacing: 0.04em;
  padding: 10px; cursor: pointer;
}

/* ---- messages: near-black glass cards ---- */
.msg-root { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.msg {
  position: absolute; left: 0; right: 0; bottom: 22%; display: flex; justify-content: center; padding: 0 20px;
  pointer-events: auto; opacity: 0; transform: translateY(10px);
  transition: opacity .7s ease, transform .9s cubic-bezier(.2, .8, .2, 1);
}
.msg.show { opacity: 1; transform: none; }
.msg.hide { opacity: 0; transform: translateY(-6px); }
.msg-card {
  position: relative; max-width: 380px; padding: 22px 26px 20px; border-radius: 20px; text-align: center;
  background: rgba(12, 12, 14, 0.64);
  border: 1px solid var(--hairline);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
}
/* a tiny warm point of light: the only accent on the card */
.msg-card::before {
  content: ''; position: absolute; top: -1px; left: 50%; width: 28px; height: 1px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0.8;
}
.msg-text { margin: 0; font-size: 16px; font-weight: 400; line-height: 1.6; letter-spacing: 0.002em; color: var(--text); text-wrap: pretty; }
.msg-sig { margin: 12px 0 0; font-size: 12px; font-weight: 500; letter-spacing: 0.04em; color: var(--text-3); }
.msg-letter { top: 9%; bottom: 9%; align-items: center; }
.msg-letter .msg-card { max-width: 440px; max-height: 100%; overflow-y: auto; text-align: left; padding: 28px 28px 24px; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.msg-title { margin: 0 0 14px; font-size: 17px; font-weight: 600; letter-spacing: 0.005em; color: var(--text); text-align: left; }
.msg-para { margin: 0 0 14px; font-size: 15px; line-height: 1.7; color: rgba(244, 238, 230, 0.86); }
.msg-letter .msg-sig { text-align: left; }

/* ---- discreet menu ---- */
.menu-btn {
  position: absolute; z-index: 25; top: calc(8px + env(safe-area-inset-top, 0px)); right: 8px;
  width: 38px; height: 34px; background: none; border: 0; display: flex; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; opacity: 0.5; transition: opacity .3s ease;
}
.menu-btn:hover { opacity: 0.85; }
.menu-btn span { width: 3px; height: 3px; border-radius: 50%; background: var(--text); }
.sheet {
  position: absolute; inset: 0; z-index: 50; display: none; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}
.sheet.show { display: flex; }
.sheet-card {
  position: relative; width: 100%; max-width: 440px; max-height: 80%; overflow-y: auto; touch-action: pan-y;
  padding: 20px 20px calc(22px + env(safe-area-inset-bottom, 0px)); border-radius: 22px 22px 0 0;
  background: rgba(14, 14, 16, 0.86); border: 1px solid var(--hairline); border-bottom: 0;
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  -webkit-user-select: text; user-select: text;
}
.sheet-card h3 { margin: 4px 0 14px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--text-2); text-align: center; }
.sheet-close { position: absolute; right: 8px; top: 6px; background: none; border: 0; color: var(--text-3); font-size: 22px; font-weight: 300; padding: 6px 10px; cursor: pointer; }
.sheet-item {
  display: block; width: 100%; margin: 0; padding: 14px 4px; text-align: left; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0;
  color: var(--text); font-size: 14.5px; font-weight: 400;
}
.sheet-item:active { color: var(--accent); }
.sheet-item.small { display: inline-block; width: auto; margin-top: 8px; padding: 9px 16px; border: 1px solid var(--hairline); border-radius: 999px; font-size: 13px; font-weight: 500; }
.sheet-more summary { cursor: pointer; padding: 14px 4px; color: var(--text-2); font-size: 14px; border-bottom: 1px solid var(--hairline); list-style: none; }
.sheet-more summary::-webkit-details-marker { display: none; }
.sheet-small { font-size: 12.5px; line-height: 1.55; color: var(--text-3); margin: 10px 4px; }
.sheet-link { color: var(--accent); text-decoration: none; }
.sheet-notes { margin-top: 6px; }
.note-line { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--hairline); color: var(--text-2); font-size: 14px; line-height: 1.5; padding: 12px 4px; cursor: pointer; }
.note-line:active { color: var(--text); }
.sheet-io textarea { width: 100%; margin-top: 8px; background: rgba(0, 0, 0, 0.5); color: var(--text-2); border: 1px solid var(--hairline); border-radius: 12px; padding: 10px; font: 11px ui-monospace, Menlo, Consolas, monospace; }

.fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; font-size: 15px; line-height: 1.55; color: var(--text-2); }

@media (min-width: 900px) {
  .tab-btn { font-size: 13.5px; }
  .caption { font-size: 13.5px; max-width: 520px; }
  .msg-text { font-size: 16.5px; }
}
