:root {
  --brand: #7c3aed;
  --brand-deep: #5b21b6;
  --brand-soft: #a78bfa;
  --bg: #f8f7fb;
  --surface: #ffffff;
  --text: #1c1a21;
  --muted: #6b6876;
  --border: #e6e3ee;
  --danger: #e5484d;
  --success: #30a46c;
  --radius: 18px;
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #8b5cf6;
    --bg: #141317;
    --surface: #1f1d24;
    --text: #f3f1f7;
    --muted: #a29fad;
    --border: #2e2b35;
  }
}

* { box-sizing: border-box; }

html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1 { font-size: 1.5rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; margin: 0; }
.center-text { text-align: center; }

svg { width: 1.2em; height: 1.2em; fill: currentColor; flex: none; }

/* Buttons */

.button, .menu button {
  font: inherit;
  cursor: pointer;
  border: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.3rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.button:active { background: var(--brand-deep); }
.button.secondary { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.button.plain { background: transparent; color: var(--muted); }
.button.small { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

.icon-button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem;
  border-radius: 999px;
  cursor: pointer;
}

/* Landing and expired pages */

.center {
  max-width: 28rem;
  margin: 0 auto;
  padding: 18vh 1.5rem 2rem;
  text-align: center;
}
.center .logo { border-radius: 22%; }
.tagline { font-size: 1.15rem; font-weight: 600; color: var(--brand); }
.stores { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 2rem; }
.open-line {
  margin-top: 2rem;
  padding: 1.1rem 1.25rem 1.25rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.open-line label { font-weight: 600; }
.open-line .small { margin: 0.25rem 0 0.75rem; }
.open-line .row { display: flex; gap: 0.5rem; }
.open-line input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.7rem 1rem;
}
.open-line input:focus { outline: 2px solid var(--brand-soft); outline-offset: -1px; }
.open-line .error { margin: 0.6rem 0 0; color: var(--danger); }
.links { display: flex; justify-content: center; gap: 1.5rem; margin-top: 2.5rem; font-size: 0.85rem; }
.links a { color: var(--muted); }

/* Home page */

.home {
  --glow-violet: rgb(167 139 250 / 45%);
  --glow-indigo: rgb(129 140 248 / 32%);
  --glow-blue: rgb(96 165 250 / 24%);
  --brand-gradient: linear-gradient(135deg, #7c3aed, #c026d3);
  --title-gradient: linear-gradient(120deg, #5b21b6, #7c3aed 45%, #db2777);
  --card-bg: rgb(255 255 255 / 72%);
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 10vh) 1.25rem calc(env(safe-area-inset-bottom) + 2rem);
  background:
    radial-gradient(56rem 34rem at 12% -8%, var(--glow-violet), transparent 70%),
    radial-gradient(48rem 30rem at 92% 2%, var(--glow-indigo), transparent 70%),
    radial-gradient(44rem 34rem at 50% 55%, var(--glow-blue), transparent 70%),
    var(--bg);
  overflow-x: hidden;
}
@media (prefers-color-scheme: dark) {
  .home {
    --glow-violet: rgb(124 58 237 / 38%);
    --glow-indigo: rgb(79 70 229 / 26%);
    --glow-blue: rgb(37 99 235 / 18%);
    --title-gradient: linear-gradient(120deg, #c4b5fd, #a78bfa 45%, #f472b6);
    --card-bg: rgb(31 29 36 / 70%);
  }
}
.home > * { max-width: 52rem; margin-inline: auto; }

.hero { text-align: center; }
.hero h1 {
  margin-top: 1.25rem;
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .tagline { margin: 0.5rem 0 0; font-size: clamp(1.15rem, 3.5vw, 1.4rem); }
.hero .lead { max-width: 34rem; margin: 1rem auto 0; color: var(--muted); font-size: 1.05rem; }
.hero .stores { flex-flow: row wrap; justify-content: center; }
.hero .stores .button { flex: 1 1 14rem; max-width: 19rem; padding: 0.9rem 1.4rem; }
.hero .stores .button:not(.secondary) { background: var(--brand-gradient); box-shadow: 0 10px 28px rgb(124 58 237 / 35%); }
.hero .stores .button.secondary { background: var(--card-bg); border: 1px solid var(--border); backdrop-filter: blur(12px); }

.home-section { margin-top: 4.5rem; }
.home-section h2 { margin-bottom: 1.5rem; font-size: 1.5rem; text-align: center; letter-spacing: -0.01em; }
.home-section h3 { margin: 0; font-size: 1.05rem; }
.home-section p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }

.card {
  padding: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}

.steps, .features { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 44rem) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .features { grid-template-columns: repeat(2, 1fr); }
}
.step-number {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 0.9rem;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
}

.features .card { display: flex; gap: 1rem; align-items: flex-start; }
.feature-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 14px;
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 15%, transparent);
}
.feature-icon svg { width: 1.4rem; height: 1.4rem; }
.feature-icon.violet { --tint: #7c3aed; }
.feature-icon.pink { --tint: #db2777; }
.feature-icon.blue { --tint: #2563eb; }
.feature-icon.green { --tint: #059669; }
@media (prefers-color-scheme: dark) {
  .feature-icon.violet { --tint: #a78bfa; }
  .feature-icon.pink { --tint: #f472b6; }
  .feature-icon.blue { --tint: #60a5fa; }
  .feature-icon.green { --tint: #34d399; }
}

.home .open-line {
  max-width: 30rem;
  margin-top: 4.5rem;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--brand-soft), #f472b6) border-box;
  box-shadow: 0 12px 36px rgb(124 58 237 / 12%);
}
.home .open-line .button { background: var(--brand-gradient); }

.home-footer { margin-top: 3rem; text-align: center; }
.home-footer .links { flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 0; }
.home-footer .small { margin-top: 1rem; }

/* Support and terms pages */

.doc {
  max-width: 44rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 2.5rem) 1.5rem calc(env(safe-area-inset-bottom) + 3rem);
}
.doc-header { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.5rem; color: inherit; text-decoration: none; }
.doc-header .logo { border-radius: 22%; }
.doc h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.doc h2 { margin-top: 2rem; }
.doc p, .doc li { line-height: 1.6; }
.doc ul { padding-left: 1.25rem; }
.doc :is(p, li, footer) a { color: var(--brand); }
.doc .contact { display: inline-flex; margin: 0.5rem 0 1rem; }
.doc .callout {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.doc footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }
.doc footer a { margin-right: 1rem; }
.doc.embed { padding-top: 1rem; }

/* Line page */

.line {
  max-width: 40rem;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 1rem calc(env(safe-area-inset-bottom) + 0.5rem);
  position: relative;
}

.banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.banner img { border-radius: 22%; }
.banner p { flex: 1; margin: 0; font-size: 0.85rem; }

.line-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 0 1rem;
}
.line-header .logo { border-radius: 22%; }
.line-header .who { flex: 1; min-width: 0; }
.line-header h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#menu-button svg { width: 1.7em; height: 1.7em; }

.menu {
  position: absolute;
  right: 1rem;
  top: 4.5rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 18%);
  overflow: hidden;
}
.menu :is(button, a) {
  padding: 0.85rem 1rem;
  text-align: left;
  background: transparent;
  color: var(--text);
  text-decoration: none;
}
.menu :is(button, a) + :is(button, a) { border-top: 1px solid var(--border); }
.menu .destructive { color: var(--danger); }

.actions { display: flex; gap: 0.75rem; }
.actions .button { flex: 1; }

.notice {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 1rem 0 0.5rem;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
  color: var(--muted);
  cursor: pointer;
}
.notice .more { color: var(--brand); font-weight: 600; white-space: nowrap; }

.status {
  margin: 0.5rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--text);
  font-size: 0.9rem;
}

.thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 0;
  overflow-y: auto;
}

.bubble {
  max-width: 80%;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
}
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble time { display: block; margin-top: 0.15rem; font-size: 0.7rem; opacity: 0.7; }
.bubble.mine { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.bubble.theirs { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.bubble.sending { opacity: 0.6; }
.bubble.failed { background: var(--danger); }
.call-event { align-self: center; margin: 0.25rem 0; font-size: 0.8rem; color: var(--muted); }
.call-event.missed { color: var(--danger); }

.composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0;
  background: var(--bg);
}
.composer .row { display: flex; gap: 0.5rem; align-items: flex-end; }
.composer input, .composer textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
}
.composer input { font-size: 0.85rem; }
.name-display { display: flex; align-items: center; gap: 0.35rem; padding-left: 0.9rem; font-size: 0.85rem; color: var(--muted); }
.name-display strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
.name-display .icon-button { padding: 0.35rem; }
.composer textarea { flex: 1; resize: none; max-height: 8rem; }
.composer input:focus, .composer textarea:focus { outline: 2px solid var(--brand-soft); outline-offset: -1px; }

.sheet {
  border: none;
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 26rem;
  width: calc(100% - 2rem);
  background: var(--surface);
  color: var(--text);
}
.sheet::backdrop { background: rgb(0 0 0 / 45%); }
.sheet .warning { color: var(--muted); font-size: 0.9rem; }
.sheet h3 { font-size: 0.95rem; margin: 1rem 0 0; }
.sheet h3 + p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }
.sheet-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.sheet a { color: var(--brand); }
.check { display: flex; gap: 0.65rem; align-items: flex-start; margin-top: 1rem; line-height: 1.4; cursor: pointer; }
.check input { flex: none; width: 1.15rem; height: 1.15rem; margin: 0.1rem 0 0; accent-color: var(--brand); }
.button:disabled { opacity: 0.45; cursor: default; }

/* Call */

.call {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 3rem) 1.5rem calc(env(safe-area-inset-bottom) + 2.5rem);
  background: linear-gradient(160deg, var(--brand-deep), #1b1530 70%);
  color: #fff;
}
.call video { display: none; }
.call.video #remote-video {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.call.video #local-video {
  display: block;
  position: absolute;
  right: 1rem;
  top: calc(env(safe-area-inset-top) + 1rem);
  width: 7rem;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 14px;
  transform: scaleX(-1);
  z-index: 1;
}
.call.remote-camera-off #remote-video, .call.local-camera-off #local-video { visibility: hidden; }
.call-info { position: relative; text-align: center; text-shadow: 0 1px 8px rgb(0 0 0 / 40%); }
.call-info h2 { font-size: 1.6rem; }
.call-info p { margin: 0; opacity: 0.85; font-variant-numeric: tabular-nums; }
.call-controls { position: relative; display: flex; gap: 1.25rem; }
.round {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  background: rgb(255 255 255 / 18%);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(12px);
}
.round svg { width: 1.6rem; height: 1.6rem; }
.round[aria-pressed="true"] { background: #fff; color: var(--brand-deep); }
.round.danger { background: var(--danger); }
.round.success { background: var(--success); }
