/* 아이콘(크림색 바탕에 복숭아·산호색 말풍선)에 맞춘 색과 둥근 모양 */
:root {
  --bg: #fff7ee;
  --fg: #3b2a24;
  --muted: #7a5f55;
  --card: #fffdfa;
  --line: #f4dfcc;
  --accent: #b8432d; /* 아이콘 뒤판의 진한 산호색. 흰 글자, 크림·연복숭아 바탕 모두 대비 4.5 이상 */
  --accent-hover: #9f3624;
  --soft: #ffe8d6;
  --hover: #fff1e5;
  --shadow: 0 8px 24px rgb(184 67 45 / .1);
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  color: var(--fg);
  background: radial-gradient(circle at 10% 0, #ffe3cb, transparent 40%) fixed, var(--bg);
  accent-color: var(--accent);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: #a8321f; }
.error:empty { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; height: 57px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; font-size: 1.1rem; }
.logo { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 2px 8px rgb(184 67 45 / .18); }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 8px; }

.wrap, .wrap-in { display: grid; gap: 16px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 8px 16px 72px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
h2 { font-size: 1.05rem; }

.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 22px; border-radius: 999px; font-weight: 600; text-decoration: none; }
.primary { border: 0; background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgb(184 67 45 / .25); }
.primary:hover { background: var(--accent-hover); }
.primary:disabled { opacity: .55; cursor: progress; }
.ghost { border: 1px solid var(--line); background: var(--card); color: var(--fg); }
.ghost:hover { background: var(--hover); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.tabs { position: sticky; top: 57px; z-index: 1; display: flex; justify-content: center; gap: 6px; padding: 10px 16px; background: rgb(255 247 238 / .92); }
.tabs button { flex: 1; max-width: 160px; min-height: 42px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 600; }
.tabs [aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }

label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
/* 아이폰은 16px보다 작은 입력칸을 누르면 화면을 확대한 채로 두므로 1rem으로 맞춘다 */
input, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--fg); font-size: 1rem; }
input:focus, select:focus { border-color: var(--accent); }

/* 로그인·오류 */
.center { min-height: calc(100dvh - 57px); display: grid; place-items: center; padding: 16px; }
.login { width: min(100%, 380px); display: grid; gap: 14px; text-align: center; }
.login img { width: 88px; height: 88px; margin: 0 auto; border-radius: 22px; }

/* 오늘: 5분 타이머 원 */
.hero { display: grid; gap: 16px; justify-items: center; text-align: center; }
.hero .actions { justify-content: center; }
.ring { --p: 0; width: 200px; aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; gap: 2px;
  background: radial-gradient(closest-side, var(--card) 82%, transparent 83%), conic-gradient(#f2664b calc(var(--p) * 1%), var(--soft) 0); }
.ring b { font-size: 2.6rem; font-variant-numeric: tabular-nums; }
.pick { width: min(100%, 420px); text-align: left; }

/* 칭찬 도장: 선생님 도장처럼 기울어진 겹테두리 원 */
.stamp { --size: 180px; width: var(--size); aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; text-align: center;
  color: var(--accent); background: rgb(255 232 214 / .6); border: 5px double var(--accent);
  box-shadow: inset 0 0 0 6px var(--card), inset 0 0 0 8px rgb(184 67 45 / .35);
  font-size: calc(var(--size) * .14); font-weight: 800; line-height: 1.15; transform: rotate(-12deg); }
.stamp small { display: block; margin-top: 6px; font-size: .45em; font-weight: 600; }
.pop { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: rotate(-12deg) scale(2.2); opacity: 0; } to { transform: rotate(-12deg) scale(1); opacity: 1; } }

/* 최근 7일 */
.week { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week li { min-width: 0; display: grid; gap: 6px; justify-items: center; font-size: .8rem; color: var(--muted); }
.dot { width: min(36px, 100%); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; border: 2px dashed var(--line); font-size: .85rem; }
.dot.on { border: 2px solid var(--accent); background: var(--soft); color: var(--accent); font-weight: 800; transform: rotate(-12deg); }
.dot.today { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 내 영상 */
.add { display: grid; gap: 12px; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.video { display: grid; grid-template-rows: auto 1fr auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.video img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--soft); }
.video strong { padding: 12px 14px 0; font-size: .95rem; line-height: 1.4; }
.video .actions { padding: 12px 14px 14px; }
.video .primary, .video .ghost { min-height: 40px; padding: 6px 16px; font-size: .9rem; }

/* 습관 */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.tile { display: grid; gap: 2px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.tile b { font-size: 1.9rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.tile span { font-size: .85rem; color: var(--muted); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--card); font-size: 1.3rem; }
.cal-head button:disabled { opacity: .35; cursor: default; }
.cal { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .head { text-align: center; font-size: .8rem; color: var(--muted); }
.cal .day { position: relative; aspect-ratio: 1; border-radius: 12px; padding: 4px 6px; background: var(--bg); font-size: .8rem; color: var(--muted); }
.cal .day.on { color: var(--fg); }
.cal .day > span:first-child { position: relative; z-index: 1; } /* 도장이 날짜 숫자를 덮지 않게 */
/* 도장은 칸 오른쪽 아래에. 화면 읽기 프로그램은 '참'을 읽지 않는다(대체 글자를 못 쓰는 브라우저는 앞의 값을 쓴다) */
.cal .day.on::after { content: "참"; content: "참" / ""; position: absolute; inset: 32% 6% 6% 26%; display: grid; place-items: center; border-radius: 50%;
  border: 2px solid var(--accent); background: rgb(255 232 214 / .9); color: var(--accent); font-size: .95rem; font-weight: 800; transform: rotate(-12deg); }
.cal .day.today { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 저장 상태 안내 */
.sync { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 8px 16px;
  border-radius: 999px; background: var(--fg); color: #fff; font-size: .85rem; text-align: center; }
.sync:empty { display: none; }

dialog { width: min(calc(100% - 32px), 360px); padding: 28px; border: 0; border-radius: 24px; text-align: center; background: var(--card); color: var(--fg); box-shadow: 0 20px 60px rgb(59 42 36 / .3); }
dialog::backdrop { background: rgb(59 42 36 / .45); }
dialog .stamp { margin: 8px auto 22px; }
dialog p { margin-top: 6px; }
dialog form { margin-top: 18px; }

/* 공부 화면: 화면 가득 Language Reactor를 띄우고 위에 남은 시간을 보인다 */
#player { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border-radius: 0; text-align: left; background: #1e1f22; }
#player[open] { display: flex; flex-direction: column; }
.player-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.player-bar .ghost { min-height: 40px; padding: 6px 14px; }
.player-bar strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-bar b { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
#player iframe { flex: 1; width: 100%; border: 0; }

@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }
