/* Shared: variables, buttons, settings dialog, phone */
:root {
  --bg: #08110c;
  --bg-2: #0e1a13;
  --panel: rgba(12, 22, 16, 0.86);
  --panel-solid: #101c15;
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef3ea;
  --muted: #9fb0a3;
  --accent: #ff8a3d;
  --accent-2: #ffb15c;
  --amber: #f2c14e;
  --leaf: #4f9a5c;
  --danger: #ff5f5f;
  --font-display: 'Cinzel', 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.1em 0.45em;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font: 600 0.85em/1.4 var(--font-body);
  text-align: center;
  color: #fff;
}

/* Buttons */
.cbtn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: 600 0.95rem/1 var(--font-body);
  padding: 0.8rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.01em;
}
.cbtn:hover { background: rgba(255, 255, 255, 0.11); transform: translateY(-1px); }
.cbtn:active { transform: translateY(0); }
.cbtn--primary {
  background: linear-gradient(135deg, var(--accent), #ff6a1a);
  border-color: transparent;
  color: #1a0c04;
  box-shadow: 0 8px 24px rgba(255, 122, 40, 0.35);
}
.cbtn--primary:hover { background: linear-gradient(135deg, #ff9a52, #ff7a2a); box-shadow: 0 10px 28px rgba(255, 122, 40, 0.45); }
.cbtn--ghost { background: transparent; }
.cbtn--small { padding: 0.5rem 0.85rem; font-size: 0.82rem; }
.cbtn--danger { background: var(--danger); border-color: transparent; color: #fff; }
.cbtn--big { font-size: 1.15rem; padding: 1.05rem 1.9rem; }
.cbtn[disabled] { opacity: 0.5; cursor: default; transform: none; }

/* Dialog */
.cdlg {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-solid);
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  box-shadow: var(--shadow);
  font-family: var(--font-body);
}
.cdlg::backdrop { background: rgba(2, 8, 5, 0.7); backdrop-filter: blur(6px); }
.cdlg__form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.cdlg__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 12px; border-bottom: 1px solid var(--line);
}
.cdlg__eyebrow { font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.cdlg__title { margin: 2px 0 0; font: 600 1.25rem/1.2 var(--font-body); }
.cdlg__x { background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 8px; }
.cdlg__x:hover { color: #fff; }
.cdlg__reason { margin: 0; padding: 12px 22px; background: rgba(255, 138, 61, 0.12); color: var(--accent-2); font-size: 0.92rem; border-bottom: 1px solid var(--line); }
.cdlg__section { padding: 16px 22px; border-bottom: 1px solid var(--line); overflow: auto; }
.cdlg__section h3 { margin: 0 0 6px; font-size: 0.95rem; }
.cdlg__section summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; list-style: none; display: flex; align-items: center; gap: 8px; }
.cdlg__section summary::before { content: '▸'; color: var(--accent); transition: transform 0.15s; }
.cdlg__section[open] summary::before { transform: rotate(90deg); }
.cdlg__section summary::-webkit-details-marker { display: none; }
.cdlg__muted { color: var(--muted); font-size: 0.85rem; margin: 4px 0 10px; line-height: 1.45; }
.cdlg__row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.cdlg__row--between { justify-content: space-between; }
.cdlg input[type="password"], .cdlg input[type="text"], .cdlg select, .cdlg__input {
  flex: 1; width: 100%;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff; padding: 10px 12px; border-radius: 10px; font: 500 0.95rem var(--font-body);
}
.cdlg select option { color: #000; }
.cdlg input:focus, .cdlg select:focus { outline: 2px solid rgba(255, 138, 61, 0.6); outline-offset: 1px; }
.cdlg__label { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 0; font-size: 0.88rem; color: var(--muted); }
.cdlg__label--inline { flex-direction: row; align-items: center; justify-content: space-between; }
.cdlg__label--inline input { flex: 1; margin-left: 12px; max-width: 220px; accent-color: var(--accent); }
.cdlg__fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0 0; padding: 8px 12px 10px; font-size: 0.88rem; }
.cdlg__fieldset legend { color: var(--muted); padding: 0 6px; }
.cdlg__fieldset label { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; cursor: pointer; }
.cdlg__check { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; font-size: 0.9rem; cursor: pointer; }
.cdlg input[type="checkbox"], .cdlg input[type="radio"] { accent-color: var(--accent); }
.cdlg__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; }

/* Phone */
.phone {
  --phone-w: 340px;
  --phone-h: 690px;
  --phone-scale: 1;
  position: fixed;
  z-index: 60;
  right: 24px;
  top: 50%;
  transform: translateY(-50%) scale(var(--phone-scale));
  transform-origin: right center;
  width: var(--phone-w);
  height: var(--phone-h);
  font-family: var(--font-body);
  color: #f4f4f4;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.6));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.phone.is-open { opacity: 1; pointer-events: auto; }
.phone--center { right: auto; left: 50%; transform: translate(-50%, -50%) scale(var(--phone-scale)); transform-origin: center; }
.phone--center.is-open { transform: translate(-50%, -50%) scale(var(--phone-scale)); }
.phone__frame {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #2b2b30, #121216);
  border-radius: 44px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.phone__frame::before {
  content: '';
  position: absolute; inset: -6px; border-radius: 50px;
  background: linear-gradient(160deg, #ff8a3d, #b4410f);
  z-index: -1;
}
.phone__screen {
  position: absolute; inset: 12px; border-radius: 34px; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #1a2c22 0%, #0a1410 55%, #060a08 100%);
  display: flex; flex-direction: column;
}
.phone__status {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 22px 0; font-size: 0.78rem; font-weight: 600; color: #cfd8d0; height: 38px;
}
.phone__notch { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 110px; height: 26px; background: #0a0a0c; border-radius: 0 0 16px 16px; z-index: 3; }
.phone__body { flex: 1; overflow: hidden; position: relative; }
.phone__app { position: absolute; inset: 0; display: none; flex-direction: column; padding: 14px 18px 12px; overflow: auto; }
.phone__app.is-active { display: flex; }
.phone__homebar { height: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.phone__homebar::after { content: ''; width: 110px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.45); }
.phone__close {
  position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2); background: #1b1f1d; color: #fff; cursor: pointer; font-size: 1rem;
}
.phone__close:hover { background: #2a302c; }

.phone__clock { margin: 26px 0 4px; font-size: 2.6rem; font-weight: 300; letter-spacing: -0.02em; text-align: center; }
.phone__date { text-align: center; color: #b7c2b9; font-size: 0.85rem; margin-bottom: 18px; }
.phone__contact {
  display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 14px;
}
.phone__avatar { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; flex: none; background: #2d4a3a; }
.phone__avatar svg { width: 100%; height: 100%; display: block; }
.phone__avatar--big { width: 108px; height: 108px; margin: 18px auto 10px; box-shadow: 0 0 0 4px rgba(255, 138, 61, 0.35); }
.phone__contact-name { font-weight: 700; font-size: 1rem; }
.phone__contact-sub { color: #9db2a2; font-size: 0.78rem; }
.phone__callbtn {
  width: 100%; border: none; border-radius: 16px; padding: 14px; font: 700 1rem var(--font-body); cursor: pointer;
  background: linear-gradient(135deg, #3ddc84, #1fa85e); color: #062112; display: flex; justify-content: center; gap: 8px; align-items: center;
  box-shadow: 0 8px 20px rgba(61, 220, 132, 0.25);
}
.phone__callbtn:hover { filter: brightness(1.08); }
.phone__callbtn[disabled] { opacity: 0.6; cursor: default; }
.phone__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.phone__appicon { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: none; color: #e6ede8; cursor: pointer; font-size: 0.7rem; }
.phone__appicon span:first-child {
  width: 54px; height: 54px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05)); border: 1px solid rgba(255, 255, 255, 0.1);
}
.phone__appicon:hover span:first-child { background: linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.08)); }
.phone__hint { color: #8fa596; font-size: 0.75rem; text-align: center; margin-top: auto; line-height: 1.4; }

.phone__apphead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.phone__back { background: none; border: none; color: var(--accent-2); cursor: pointer; font-size: 0.9rem; padding: 4px 6px 4px 0; }
.phone__apptitle { font-weight: 700; font-size: 1.05rem; }

/* Call app */
.phone__call { display: flex; flex-direction: column; height: 100%; }
.phone__callname { text-align: center; font-weight: 700; font-size: 1.2rem; }
.phone__callstate { text-align: center; color: #9db2a2; font-size: 0.82rem; min-height: 1.2em; }
.phone__timer { text-align: center; color: #cfe3d4; font-variant-numeric: tabular-nums; font-size: 0.85rem; margin-top: 2px; }
.phone__wave { display: block; width: 100%; height: 44px; margin: 8px 0 4px; }
.phone__transcript { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; font-size: 0.82rem; line-height: 1.35; scrollbar-width: thin; }
.phone__bubble { max-width: 88%; padding: 7px 10px; border-radius: 14px; white-space: pre-wrap; }
.phone__bubble--user { align-self: flex-end; background: #2f6f4f; border-bottom-right-radius: 4px; }
.phone__bubble--cara { align-self: flex-start; background: rgba(255, 255, 255, 0.1); border-bottom-left-radius: 4px; }
.phone__bubble--sys { align-self: center; background: none; color: #8fa596; font-size: 0.72rem; text-align: center; }
.phone__controls { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 8px; }
.phone__ctl { border: none; border-radius: 14px; padding: 10px 4px; background: rgba(255, 255, 255, 0.09); color: #fff; cursor: pointer; font-size: 0.72rem; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.phone__ctl span:first-child { font-size: 1.15rem; }
.phone__ctl:hover { background: rgba(255, 255, 255, 0.16); }
.phone__ctl.is-on { background: var(--accent); color: #1a0c04; }
.phone__ctl--end { background: #e5484d; }
.phone__ctl--end:hover { background: #ff5a5f; }
.phone__ctl--ptt.is-talking { background: #3ddc84; color: #062112; }
.phone__error { color: #ffb3b3; font-size: 0.8rem; text-align: center; padding: 6px 4px; }

/* Objectives / Journal */
.phone__list { display: flex; flex-direction: column; gap: 8px; }
.phone__item { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); font-size: 0.85rem; line-height: 1.4; }
.phone__item--done { opacity: 0.55; text-decoration: line-through; }
.phone__item--current { border: 1px solid rgba(255, 138, 61, 0.55); background: rgba(255, 138, 61, 0.12); }
.phone__item--locked { color: #7c8f82; font-style: italic; }
.phone__item h4 { margin: 0 0 4px; font-size: 0.85rem; color: var(--accent-2); }
.phone__map { width: 100%; aspect-ratio: 1; border-radius: 14px; background: #0c1a12; display: block; }
.phone__legend { font-size: 0.72rem; color: #9db2a2; margin-top: 8px; line-height: 1.5; }

@media (max-height: 760px) { .phone { --phone-scale: 0.86; } }
@media (max-height: 640px) { .phone { --phone-scale: 0.74; } }
@media (max-width: 480px) { .phone { --phone-scale: 0.8; right: 8px; } }

/* Items & journal playback */
.phone__find-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.phone__find-head h4 { margin: 0; }
.phone__play { border: none; border-radius: 999px; width: 30px; height: 30px; background: var(--accent); color: #1a0c04; cursor: pointer; font-size: 0.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.phone__play:hover { filter: brightness(1.12); }
.phone__play.is-playing { background: #3ddc84; }
.phone__item--find div:last-child { margin-top: 4px; color: #d3ddd5; }

/* ---- Generated artwork (assets/images) ---- */
.phone__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.phone__app[data-app="home"] { background: linear-gradient(180deg, rgba(6, 10, 8, 0.3) 0%, rgba(8, 14, 11, 0.86) 30%, #0a1410 44%), url(../assets/images/web/phone-wallpaper-360.webp) center top / 100% auto no-repeat; }
.phone__app[data-app="call"] { background: linear-gradient(180deg, rgba(6, 10, 8, 0.72) 0%, rgba(6, 10, 8, 0.92) 40%, #060a08 75%), url(../assets/images/web/phone-wallpaper-360.webp) center top / cover no-repeat; }
.overlay__art { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; margin: 0 0 16px; }
#loading { background-image: linear-gradient(rgba(6, 10, 8, 0.55), rgba(6, 10, 8, 0.85)), url(../assets/images/web/hero-jungle-1280.webp); background-size: cover; background-position: center; }
