:root {
  color-scheme: light;
  --celadon: #DCE8E2;
  --paper: #F8FBF9;
  --indigo: #1F3A63;
  --ink: #18263C;
  --muted: #526477;
  --line: #C3D3CB;
  --turn: #E5A823;
  --warn: #A8322B;
  --warn-bg: #F9E9E5;
  --ok: #2E7555;
  --display: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
  --body: 'BIZ UDPGothic', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  --lang-ja: #C2476B; --lang-en: #2F5FA8; --lang-ko: #4E9B6E;
  --lang-zh: #D9971E; --lang-es: #D4682B; --lang-fr: #7A58B0;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--celadon); color: var(--ink); font: 400 16px/1.75 var(--body); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.35; margin: 0; color: var(--indigo); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.08rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--turn); outline-offset: 2px; }

#app { max-width: 560px; min-height: 100dvh; margin: 0 auto; background: var(--paper); display: flex; flex-direction: column; }
.page { flex: 1; padding: 24px 20px 104px; display: flex; flex-direction: column; gap: 20px; }
.muted { color: var(--muted); font-size: .9rem; }

/* ボタンは操作の重要度で形を変える */
.btn { flex: none; white-space: nowrap; min-height: 44px; padding: 8px 20px; border-radius: 22px; border: 0; background: var(--indigo); color: #fff; font-weight: 700; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.quiet { background: transparent; color: var(--indigo); box-shadow: inset 0 0 0 1.5px var(--indigo); }
.btn.danger { background: var(--warn); }
.btn.wide { width: 100%; }
.link { background: none; border: 0; padding: 8px 4px; min-height: 40px; color: var(--indigo); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link.warn { color: var(--warn); }

/* 言の輪 */
.ring { --a: var(--lang-ja); --b: var(--lang-en); width: var(--size, 52px); height: var(--size, 52px); flex: none; border-radius: 50%; position: relative;
  background: conic-gradient(var(--a) 0 50%, var(--b) 50% 100%); display: grid; place-items: center; }
.ring > span { width: 78%; height: 78%; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-family: var(--display); font-weight: 900; color: var(--indigo); font-size: calc(var(--size, 52px) * .36); position: relative; }

/* 入口 */
.hero { padding: 40px 20px 28px; background: var(--indigo); color: #fff; overflow: hidden; position: relative; min-height: 400px; display: flex; flex-direction: column; justify-content: flex-end; }
.hero h1 { color: #fff; font-size: clamp(2rem, 9vw, 2.75rem); font-weight: 900; max-width: 9em; position: relative; }
.hero p { margin-top: 12px; max-width: 26em; position: relative; color: #E4ECF4; }
.hero-ring { position: absolute; right: -96px; top: -150px; --size: 340px; --a: var(--turn); --b: #6E9BC9; animation: turn-in 1.1s cubic-bezier(.2,.7,.2,1) both; }
.hero-ring > span { background: var(--indigo); }
@keyframes turn-in { from { transform: rotate(-120deg); } to { transform: rotate(0); } }
.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.promises li { position: relative; padding-left: 26px; }
.promises li::before { content: ''; position: absolute; left: 0; top: .42em; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle, var(--paper) 0 3px, transparent 3.5px), conic-gradient(var(--turn) 0 50%, var(--indigo) 50% 100%); }
.notice { padding: 12px 14px; background: #FFF6DE; border-radius: 4px 14px 14px 14px; font-size: .95rem; }

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 4px; }
.field > label, .field > .label { font-weight: 700; font-size: .95rem; }
input[type=text], select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; }
textarea { resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; }
.chip[aria-pressed=true] { background: var(--indigo); border-color: var(--indigo); color: #fff; }

/* 下部タブ */
.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(560px, 100%); display: grid; grid-template-columns: repeat(5, 1fr); background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { min-height: 58px; display: grid; place-items: center; color: var(--muted); text-decoration: none; font-size: .86rem; font-weight: 700; position: relative; }
.tabs a[aria-current=page] { color: var(--indigo); box-shadow: inset 0 3px 0 var(--indigo); }
.tabs .dot { position: absolute; top: 10px; right: calc(50% - 26px); width: 9px; height: 9px; border-radius: 50%; background: var(--turn); }

/* 人の一覧 */
.people { list-style: none; margin: 0; padding: 0; }
.person { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person-link { color: inherit; text-decoration: none; display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.langs { font-size: .9rem; color: var(--muted); }
.signals { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .86rem; color: var(--muted); margin-top: 2px; }
.signals .good { color: var(--ok); font-weight: 700; }
.signals .caution { color: var(--warn); font-weight: 700; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.excerpt { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; color: var(--muted); font-size: .92rem; }
.empty { padding: 32px 0; display: grid; gap: 12px; justify-items: start; }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.as-btn { text-decoration: none; display: inline-grid; place-items: center; }

/* 会話 */
.chat { flex: 1; display: flex; flex-direction: column; height: 100dvh; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-head h2 { font-size: 1.12rem; }
.back { color: var(--indigo); text-decoration: none; font-weight: 700; padding: 8px; min-height: 40px; display: grid; place-items: center; }
.session { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #E9F0EC; }
.session .ring > span { font-size: .78rem; font-weight: 700; }
.session-body { flex: 1; min-width: 0; }
.session-now { font-family: var(--display); font-weight: 700; color: var(--indigo); }
.session.out { background: #FFF6DE; }

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.msg { max-width: 84%; align-self: flex-start; display: grid; gap: 4px; }
.msg.mine { align-self: flex-end; justify-items: end; }
.bubble { display: block; text-align: left; width: fit-content; max-width: 100%; padding: 10px 14px; background: #E6EEEA; border: 0; border-radius: 4px 16px 16px 16px; overflow-wrap: anywhere; white-space: pre-wrap; cursor: pointer; }
.msg.mine .bubble { background: var(--indigo); color: #fff; border-radius: 16px 4px 16px 16px; cursor: default; }
.msg-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.translated { padding: 4px 0 0 14px; font-size: .95rem; color: var(--muted); }
.warning { background: var(--warn-bg); color: #6E1E18; padding: 10px 14px; font-size: .92rem; border-radius: 4px 14px 14px 14px; }
.correction { background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: .92rem; justify-self: stretch; text-align: left; }
.correction strong { color: var(--ok); }
.composer { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
.composer textarea { min-height: 44px; height: 44px; max-height: 120px; }
.composer .btn { flex: none; white-space: nowrap; }

/* あんしん、じぶん */
.section { display: grid; gap: 10px; padding-top: 4px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.log li:last-child { border-bottom: 0; }
.log li.acted > b { color: var(--warn); }
.switch-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; min-height: 48px; }
.switch-row input { width: 24px; height: 24px; accent-color: var(--indigo); flex: none; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.stats { display: flex; gap: 28px; }
.stats b { display: block; font: 900 1.7rem/1.2 var(--display); color: var(--indigo); }
.plan { background: var(--indigo); color: #fff; padding: 20px; border-radius: 4px 22px 22px 22px; display: grid; gap: 10px; }
.plan h3 { color: #fff; }
.plan .price { font: 900 2rem/1.2 var(--display); }
.plan ul { margin: 0; padding-left: 1.2em; }
.plan .btn { background: var(--turn); color: var(--ink); }
.plan .btn.quiet { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px #fff; }
.plan .small { font-size: .85rem; color: #D5E0EC; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; font-size: .85rem; }

/* 下から出るシート */
dialog { width: min(560px, 100%); max-width: 100%; margin: auto auto 0; border: 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--paper); color: var(--ink); max-height: 88dvh; }
dialog::backdrop { background: rgb(24 38 60 / .5); }
dialog[open] { animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(24px); } to { transform: none; } }
.radio-list { display: grid; gap: 2px; }
.radio-list label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.radio-list input { margin-top: 6px; accent-color: var(--indigo); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

#toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 20; }
#toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
