/* gigglylab 공통 스타일 — 사이트 전체가 "영어 공부 공책" 한 권이에요.
   종이 · 괘선 하늘 · 여백선 빨강 · 만년필 남색 · 형광펜 노랑 · 지우개 분홍
   모든 페이지가 이 파일 하나를 같이 써요. 페이지마다 --accent(색연필 색)만 바꿔요. */
:root {
  --bg: #f1f5fa;          /* 칸 안을 채우는 연한 모눈 파랑 */
  --paper: #ffffff;
  --ink: #142033;         /* 만년필 남색 */
  --ink-soft: #5b6578;
  --line: #dde5ef;
  --rule: #c6d8ee;        /* 공책 줄 */
  --grid: #e7eef7;        /* 모눈 */
  --margin: #e5484d;      /* 빨간 펜 */
  --hi: #ffe600;          /* 형광펜 */
  --eraser: #fbd3d6;
  --eraser-ink: #c9303a;
  --good: #1d7f57;
  --accent: #e5484d;      /* 페이지마다 바꾸는 색연필 색 */
  --accent-soft: #fde4e4;
  --mint: #bfe6d3;
  --radius: 12px;
  --shadow: 0 0 0 1.5px var(--ink), 0 4px 0 1.5px var(--ink);
  --press: 0 3px 0 #05080f;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --type: "Courier Prime", "Courier New", ui-monospace, monospace;
}
@font-face { font-family: "Courier Prime"; src: url("fonts/courier-prime-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("fonts/courier-prime-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* 5mm 모눈 공책 */
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    #fff;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--hi); color: var(--ink); }
:focus-visible { outline: 3px solid var(--hi); outline-offset: 2px; border-radius: 4px; }

/* ---------- 머리말 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--ink);
}
.site-header .inner {
  max-width: 1040px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 20px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; font-weight: 800; letter-spacing: -0.03em; font-size: 19px;
}
.logo img { display: block; }
.logo span b { color: var(--margin); font-weight: 800; }
.nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  text-decoration: none; font-size: 14px; font-weight: 700;
  padding: 6px 11px; color: var(--ink-soft); border-radius: 4px;
}
.nav a:hover { color: var(--ink); background: linear-gradient(transparent 40%, rgba(255, 228, 92, .45) 40% 78%, transparent 78%); }
/* 지금 페이지는 형광펜으로 칠해요 */
.nav a.on { color: var(--ink); background: linear-gradient(transparent 40%, var(--hi) 40% 78%, transparent 78%); }
.nav a.soon { opacity: .45; pointer-events: none; }

/* ---------- 공통 조각 ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 32px 20px 72px; }
.card {
  background: var(--paper); border: 0;
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.card h2 { font-size: 15px; font-weight: 800; margin: 0 0 14px; letter-spacing: -0.01em; }
.card h2 small { font-weight: 500; color: var(--ink-soft); margin-left: 6px; }

/* 버튼 — 꾹 눌리는 자판 */
.btn {
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  padding: 9px 17px; border-radius: 10px; font-weight: 800; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: translate .08s ease, box-shadow .08s ease, background .15s ease;
}
.btn:hover { background: #fff; }
.btn:active { translate: 0 2px; box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--ink); color: #fff; box-shadow: var(--press); }
.btn.primary:active { box-shadow: 0 1px 0 #0e172b; }
.btn.accent { background: var(--accent); border-color: var(--ink); color: #fff; }
.btn:disabled { opacity: .35; cursor: default; translate: none; }
.muted { color: var(--ink-soft); }

/* 고르기 버튼 묶음 */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: #eceff4; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: #fff; box-shadow: none; }

/* 체크 상자 — 공책 네모 칸에 빨간 펜으로 ✓ */
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; }
input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0;
  width: 20px; height: 20px; border: 2px solid var(--ink); border-radius: 4px;
  background: var(--paper) center / 0 no-repeat; cursor: pointer;
  transition: background-size .15s cubic-bezier(.3, 1.6, .5, 1);
}
input[type="checkbox"]:checked {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.5 12.8c1.6 1.2 3.1 2.9 4.4 5.2C11.6 11.4 15.4 6.6 21 3.2' fill='none' stroke='%23d6453f' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 130%;
}
input[type="checkbox"]:focus-visible { outline: 3px solid var(--hi); outline-offset: 2px; }
input[type="range"] { accent-color: var(--ink); }

/* 틀렸을 때: 빨간 테두리 + 좌우로 흔들흔들 */
@keyframes gl-shake { 0%, 100% { translate: 0; } 15% { translate: -9px; } 30% { translate: 8px; } 45% { translate: -6px; } 60% { translate: 5px; } 75% { translate: -3px; } 90% { translate: 2px; } }
.is-wrong { border-color: var(--margin) !important; box-shadow: 0 0 0 4px rgba(229, 72, 77, .22) !important; animation: gl-shake .42s cubic-bezier(.36, .07, .19, .97); }

/* 입력칸 */
input[type="text"], input[type="password"], input[type="url"], textarea, select { border-radius: 10px; }

.site-footer {
  border-top: 1.5px solid var(--ink); color: var(--ink-soft); font-size: 13px; background: var(--paper);
}
.site-footer .inner {
  max-width: 1040px; margin: 0 auto; padding: 20px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 60;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none;
  box-shadow: 0 10px 24px -10px rgba(14, 23, 43, .6);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 작은 타이머 (다른 페이지에서 공부할 때) ---------- */
.mini-timer {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  display: flex; align-items: center; gap: 4px; padding: 6px 6px 9px 6px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 14px;
  box-shadow: 0 3px 0 var(--ink), 0 14px 26px -12px rgba(30, 43, 69, .45);
  overflow: hidden; animation: mt-in .35s cubic-bezier(.3, 1.5, .5, 1);
}
.mini-timer[hidden] { display: none; }
/* 휴대폰에서 글자를 칠 때는 작은 타이머를 잠깐 숨겨요 (키보드 위를 가리지 않게) */
@media (max-width: 640px) { body:has(input:focus, textarea:focus) .mini-timer { display: none; } }
@keyframes mt-in { from { translate: 0 30px; opacity: 0; } }
.mt-main { display: flex; align-items: center; gap: 8px; text-decoration: none; padding: 0 6px 0 2px; border-radius: 10px; }
.mt-main img { width: 46px; height: 40px; object-fit: contain; }
.mt-txt { display: grid; line-height: 1.15; }
.mt-time { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mt-label { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.mt-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 0; cursor: pointer;
  background: #eceff4; color: var(--ink); font-size: 12px; font-weight: 900;
}
.mt-btn:hover { background: var(--hi); }
.mt-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #e8edf4; }
.mt-bar i { display: block; height: 100%; background: #e8743f; transform-origin: left; transition: transform .5s linear; }
.mini-timer.is-break .mt-bar i { background: #3f9b78; }
.mini-timer.is-paused .mt-time { color: var(--ink-soft); }
.mini-timer.is-done { background: #fffbe0; }
.mini-timer.is-done .mt-bar i { background: var(--hi); }

@media (max-width: 640px) {
  .mini-timer { right: 10px; bottom: 10px; }
  .site-header .inner { flex-wrap: wrap; gap: 6px; }
  .site-header .inner { padding: 10px 12px 6px; }
  .nav { margin: 0; width: 100%; display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; gap: 0; }
  .nav a { white-space: nowrap; padding: 6px 4px; font-size: 13px; letter-spacing: -0.03em; }
  .wrap { padding: 20px 14px 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
