/* The browser version of いつメン！ (issue #84). The look follows the
   design doc's "デザインの土台": the bias-works base (M PLUS 2, ink
   buttons, frosted panels, no lines or shadows) plus いつメン！'s own
   (the character's color as a flat fill, the standing picture as the hero). */

:root {
  --ink: #23202b;
  --sub: #5c5866;
  --cream: #fff4e8;
  --mark: #e8631a; /* the "！" of the logo */
  --hang-up: #c8472a;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --r-card: 28px;
  --r-field: 20px;
  /* The character on screen sets these (see data-character below). */
  --c-strong: #ffc48f;
  --c-soft: #ffe4d0;
  --c-band: #ffd2b0;
}

[data-character="imouto"] { --c-strong: #ffc48f; --c-soft: #ffe4d0; --c-band: #ffd2b0; }
[data-character="ojousama"] { --c-strong: #f7bcd8; --c-soft: #fde0ec; --c-band: #fbd0e3; }
[data-character="senpai"] { --c-strong: #b3cff0; --c-soft: #dce9f8; --c-band: #c9dcf4; }

* { box-sizing: border-box; }

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

body {
  background: var(--cream);
  color: var(--ink);
  font-family: "M PLUS 2", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
}

main {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Backgrounds: the character's color, faded into cream. */
main.bg-character { background: linear-gradient(180deg, var(--c-strong) 0%, var(--c-soft) 42%, var(--cream) 100%); }
main.bg-band { background: linear-gradient(180deg, var(--c-band) 0px, var(--c-band) 96px, var(--cream) 220px); }

h1 { margin: 0; font-size: 32px; font-weight: 900; line-height: 1.25; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--ink); }

.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.logo { font-size: 15px; font-weight: 900; letter-spacing: -0.02em; }
.logo b { color: var(--mark); font-weight: 900; }
.back { font-size: 13px; font-weight: 800; text-decoration: none; padding: 10px 0; }
.note { font-size: 12px; font-weight: 600; color: var(--sub); }
.center { text-align: center; }
.push-down { margin-top: auto; }
.draft { font-size: 11px; font-weight: 800; color: var(--hang-up); }

.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-edge);
  color: var(--ink); text-decoration: none;
}

/* Buttons: ink for the main action, frosted glass for the rest. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 0 20px; border-radius: 999px;
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
  border: 0; background: var(--ink); color: #fff;
}
.btn.glass { background: var(--glass); border: 1px solid var(--glass-edge); color: var(--ink); font-weight: 600; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* A character as a card (welcome and home). */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.char-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 12px 12px; border-radius: var(--r-card);
  background: linear-gradient(90deg, var(--c-strong) 0%, var(--c-soft) 100%);
  color: var(--ink); text-decoration: none; border: 0; font: inherit; text-align: left; width: 100%; cursor: pointer;
}
.char-card img {
  width: 88px; height: 116px; object-fit: cover; object-position: top;
  mix-blend-mode: multiply; border-radius: var(--r-field); flex-shrink: 0;
}
.char-card .body { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; min-width: 0; }
.char-card .name { font-size: 18px; font-weight: 900; }
.char-card .role { font-size: 12px; font-weight: 600; }
.char-card .says { font-size: 13px; line-height: 1.5; }
.char-card .pick { font-size: 13px; font-weight: 800; padding: 8px 12px; border-radius: 999px; background: var(--ink); color: #fff; flex-shrink: 0; }
.dot { width: 12px; height: 12px; border-radius: 999px; background: #2e9e5b; flex-shrink: 0; }
.dot.off { background: #b9b3bf; }

/* 05-2: the character as the hero, then the four ways to talk. */
.stage { display: flex; align-items: flex-end; gap: 8px; flex-grow: 1; min-height: 300px; }
.stage img { width: 200px; height: 300px; object-fit: cover; object-position: top; mix-blend-mode: multiply; flex-shrink: 0; margin-left: -12px; }
.stage .speech { display: flex; flex-direction: column; gap: 8px; padding-bottom: 40px; flex-grow: 1; min-width: 0; }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: 84px; border-radius: var(--r-card);
  background: var(--glass); border: 1px solid var(--glass-edge); backdrop-filter: blur(20px);
  color: var(--ink); text-decoration: none; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
}
.mode svg { flex-shrink: 0; }
.mode .note { line-height: 1.2; }
.mode[aria-disabled="true"] { opacity: 0.55; cursor: default; }

/* Chat bubbles: the character in white, the user in ink. */
.who { display: flex; align-items: center; gap: 12px; }
.who img { width: 56px; height: 56px; object-fit: cover; mix-blend-mode: multiply; border-radius: 999px; background: #fff; flex-shrink: 0; }
.who .name { font-size: 18px; font-weight: 900; line-height: 1.3; }
.log { display: flex; flex-direction: column; gap: 10px; flex-grow: 1; }
.bubble { max-width: 300px; padding: 12px 16px; border-radius: var(--r-field); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.them { align-self: flex-start; background: #fff; }
.bubble.me { align-self: flex-end; background: var(--ink); color: #fff; }
.choices { align-self: flex-start; }
.composer { display: flex; gap: 8px; }
.composer input {
  flex-grow: 1; min-width: 0; height: 52px; border-radius: 999px;
  border: 1px solid var(--glass-edge); background: var(--glass);
  padding: 0 18px; font: inherit; color: var(--ink);
}
.composer button { width: 52px; flex-shrink: 0; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Settings rows on frosted panels. */
.panel {
  padding: 14px 20px; border-radius: var(--r-card);
  background: var(--glass); border: 1px solid var(--glass-edge); backdrop-filter: blur(20px);
  display: flex; flex-direction: column; gap: 10px;
}
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; color: var(--ink); text-decoration: none; }
.panel-row strong { font-weight: 800; }
.panel input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ink); }
.panel-row.off { color: var(--sub); }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.panel h2 { margin: 0; font-size: 16px; font-weight: 800; }
.panel.quiet { background: #f0e4d8; border-color: transparent; backdrop-filter: none; }
.stack { display: flex; flex-direction: column; gap: 2px; }
.field {
  min-width: 0; height: 44px; border-radius: 999px;
  border: 1px solid var(--glass-edge); background: var(--glass);
  padding: 0 16px; font: inherit; color: var(--ink);
}
.panel-row .field { flex: 1; }
.field[type="time"] { padding: 0 10px; }
.report { align-self: flex-start; margin-top: -4px; padding: 2px 8px; border: 0; background: none; font: inherit; font-size: 11px; font-weight: 600; color: var(--sub); cursor: pointer; }
.report:disabled { cursor: default; }
