@font-face { font-family: Gaegu; src: url(/fonts/gaegu-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Gaegu; src: url(/fonts/gaegu-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #fffdf6; --ink: #2b2622; --soft: #7b7268; --pale: #e7e0d2;
  --red: #e2483b; --green: #3f8f5c; --red-wash: #fde3df; --green-wash: #e2f2e6;
  --wob1: 255px 16px 225px 16px / 16px 225px 16px 255px;
  --wob2: 16px 225px 16px 255px / 255px 16px 225px 16px;
  --wob3: 225px 20px 255px 14px / 14px 255px 20px 225px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background-color: var(--paper);
  background-image: linear-gradient(rgba(63, 143, 92, .1) 1px, transparent 1px), linear-gradient(90deg, rgba(63, 143, 92, .1) 1px, transparent 1px);
  background-size: 26px 26px;
  font: 400 19px/1.45 Gaegu, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  word-break: keep-all; overflow-wrap: anywhere;
}
#app { max-width: 600px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
h1, h2 { margin: 0; line-height: 1.15; font-weight: 700; }
h1 { font-size: 25px; }
h2 { font-size: 22px; }
header h1 { text-decoration: underline wavy var(--red) 2px; text-underline-offset: 6px; }
p { margin: 0; }
.muted { color: var(--soft); font-size: 17px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 16px; }
.card { background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--wob1); padding: 18px; }
.stack > .card:nth-child(even) { border-radius: var(--wob2); }
.stack > .card:nth-child(3n) { border-radius: var(--wob3); }
input, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: inherit; background: #fff;
  border: 2px solid var(--ink); border-radius: var(--wob2);
}
input::placeholder, textarea::placeholder { color: var(--soft); }
input:focus-visible, textarea:focus-visible, button:focus-visible, label.btn:focus-within {
  outline: 3px dashed var(--red); outline-offset: 2px;
}
textarea { min-height: 92px; resize: vertical; border-radius: var(--wob3); }
label { display: grid; gap: 2px; font-size: 18px; color: var(--ink); }
button, .btn {
  font: inherit; font-weight: 700; min-height: 46px; padding: 6px 18px; cursor: pointer;
  border: 2.5px solid var(--ink); border-radius: var(--wob1); background: var(--red); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 2px 3px 0 var(--ink);
}
button:active, .btn:active { transform: translate(2px, 3px); box-shadow: none; }
button:disabled { opacity: .5; cursor: default; }
button.ghost, .btn.ghost { background: var(--paper); color: var(--ink); border-radius: var(--wob2); }
button.link { background: none; border: 0; box-shadow: none; color: var(--soft); padding: 2px 4px; min-height: 32px; font-weight: 400; font-size: 17px; text-decoration: underline; }
.btn input { display: none; }

.who-red { color: var(--red); }
.who-green { color: var(--green); }

.auth { min-height: 84vh; display: grid; align-content: center; gap: 18px; }
.auth h1 { font-size: 36px; text-align: center; transform: rotate(-1.2deg); }
.auth-art { display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
.auth-art img { width: 84px; }
.auth-art img:nth-child(2) { width: 58px; margin-bottom: 44px; }
.auth-art img:nth-child(3) { transform: scaleX(-1); }
.error { color: var(--red); font-size: 17px; min-height: 24px; }

.hero { position: relative; display: grid; gap: 8px; overflow: hidden; background: var(--green-wash); }
.hero .count { font-size: 68px; font-weight: 700; line-height: 1; color: var(--red); transform: rotate(-2deg); transform-origin: left; }
.hero .count small { font-size: 28px; margin-left: 4px; color: var(--ink); }
.hero .dino { position: absolute; right: 8px; top: 34px; width: 112px; transform: rotate(2deg); }
.hero .meteor { position: absolute; right: 86px; top: 4px; width: 50px; }
.hero ul { margin: 0; padding: 8px 0 0; list-style: none; border-top: 2px dashed var(--ink); display: grid; gap: 0; }
.hero li { display: flex; justify-content: space-between; gap: 8px; }
.hero li.today { color: var(--red); font-weight: 700; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 2px 0 env(safe-area-inset-bottom); background: var(--paper); border-top: 2.5px solid var(--ink);
}
.tabs button { flex: 1 1 auto; max-width: 170px; white-space: nowrap; background: none; border: 0; box-shadow: none; color: var(--soft); min-height: 56px; padding: 4px 2px; font-size: 18px; }
.tabs button[aria-current="page"] { color: var(--red); text-decoration: underline wavy var(--red) 2px; text-underline-offset: 5px; }

.previews { display: flex; gap: 8px; overflow-x: auto; }
.previews img { width: 72px; height: 72px; object-fit: cover; flex: none; border: 2px solid var(--ink); border-radius: var(--wob2); }

.post { display: grid; gap: 10px; }
.post .body { white-space: pre-wrap; font-size: 21px; }
.photos { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); padding: 4px; }
.photos.one { grid-template-columns: 1fr; }
.photos a { display: block; background: #fff; padding: 6px 6px 18px; border: 2px solid var(--ink); transform: rotate(-1deg); }
.photos a:nth-child(even) { transform: rotate(1.2deg); }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--pale); }
.photos.one img { aspect-ratio: auto; max-height: 70vh; object-fit: contain; }
.heart { background: var(--paper); color: var(--ink); padding: 2px 12px; min-height: 40px; box-shadow: none; font-size: 18px; }
.heart img { width: 20px; filter: grayscale(1) opacity(.45); }
.heart.on { background: var(--red-wash); }
.heart.on img { filter: none; }
.comments { display: grid; gap: 6px; border-top: 2px dashed var(--pale); padding-top: 10px; }
.comment { display: flex; gap: 8px; align-items: baseline; }
.comment b { flex: none; }
.comment span { flex: 1; white-space: pre-wrap; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; min-width: 0; }

.score { display: flex; justify-content: center; gap: 20px; font-weight: 700; font-size: 21px; }
.status { text-align: center; font-weight: 700; font-size: 22px; min-height: 30px; }
.seg { display: flex; gap: 10px; }
.seg button { flex: 1; }
.seg button[aria-pressed="false"] { background: var(--paper); color: var(--ink); box-shadow: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; }
.dot.on { background: var(--green); }

.board { display: grid; width: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.board button { padding: 0; min-height: 0; border: 0; box-shadow: none; border-radius: 0; background: none; aspect-ratio: 1; position: relative; }
.board button:active { transform: none; }
.board.gomoku {
  grid-template-columns: repeat(15, 1fr); background: #fff url(/gomoku.svg) center / 100% 100% no-repeat;
  border: 2.5px solid var(--ink); border-radius: 12px 18px 10px 16px / 16px 10px 18px 12px;
}
.board i { position: absolute; z-index: 1; border-radius: 48% 52% 55% 45% / 52% 45% 55% 48%; }
.board button:nth-child(3n) i { border-radius: 54% 46% 45% 55% / 46% 56% 44% 54%; }
.board button:nth-child(4n) i { border-radius: 45% 55% 52% 48% / 55% 48% 52% 45%; }
.board.gomoku i { inset: 6%; }
.board.connect4 {
  grid-template-columns: repeat(7, 1fr); gap: 6px; background: var(--green-wash); padding: 8px;
  border: 2.5px solid var(--ink); border-radius: var(--wob1);
}
.board.connect4 button { background: #fff; border: 2px dashed var(--ink); border-radius: 50%; }
.board.connect4 i { inset: -2px; }
.red-first .s1 i, .green-first .s2 i { background: var(--red); box-shadow: inset 0 0 0 2px var(--ink); }
.green-first .s1 i, .red-first .s2 i { background: var(--green); box-shadow: inset 0 0 0 2px var(--ink); }
.board .preview i { background: rgba(43, 38, 34, .25); }
.board .last i { outline: 2px solid #fff; outline-offset: -5px; }
.board .win i { box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 3px #f6c945; }

.tickets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tickets > div { padding: 10px; text-align: center; border: 2.5px solid var(--ink); border-radius: var(--wob1); background: var(--paper); transform: rotate(-.8deg); }
.tickets > div + div { border-radius: var(--wob2); transform: rotate(.8deg); }
.tickets b { display: block; font-size: 52px; line-height: 1; }
.ticket { display: grid; gap: 6px; background: #fff8d9; border: 2.5px dashed var(--ink); border-radius: var(--wob3); padding: 14px 16px; }
.ticket:nth-child(even) { transform: rotate(-.5deg); }
.ticket .wish { font-weight: 700; font-size: 23px; }
.ticket-form { display: flex; gap: 8px; }
.ticket-form input { flex: 1; min-width: 0; }
.log { display: grid; font-size: 16px; color: var(--soft); }
.tag { font-size: 16px; font-weight: 700; border: 2px solid currentColor; border-radius: var(--wob2); padding: 0 8px; flex: none; }

#toast {
  position: fixed; left: 50%; bottom: calc(74px + env(safe-area-inset-bottom)); transform: translateX(-50%) rotate(-1deg);
  background: var(--ink); color: var(--paper); padding: 6px 14px; border-radius: var(--wob1);
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw;
}
#toast.show { opacity: 1; }
