* { box-sizing: border-box; }

:root {
  --bg1: #f8fbff;
  --bg2: #f2f8f4;
  --bg3: #fff8ec;
  --ink: #172033;
  --line: #243044;
  --paper: #fcfdfb;
  --soft: #f0fbff;
  --warm: #fff8df;
  --good: #d8f7df;
  --bad: #ffe0e7;
  --good-strong: #35c56b;
  --bad-strong: #ff6d8c;
  --muted: #536071;
  --shadow: 8px 8px 0 var(--line);
  --radius: 8px;
  --font: Arial, "Malgun Gothic", sans-serif;
}

body.theme-crt {
  --bg1: #07130e;
  --bg2: #0b1f18;
  --bg3: #06100c;
  --ink: #d6ffe5;
  --line: #6cff9f;
  --paper: #08150f;
  --soft: #10261a;
  --warm: #142b19;
  --good: #0f3d22;
  --bad: #371622;
  --good-strong: #42ff8b;
  --bad-strong: #ff5c8b;
  --muted: #9bd8b4;
  --shadow: 0 0 0 2px rgba(108, 255, 159, .12), 0 0 28px rgba(66, 255, 139, .18);
  --radius: 6px;
  --font: "Lucida Console", Consolas, "Malgun Gothic", monospace;
}

body.theme-excel {
  --bg1: #eef6f0;
  --bg2: #f7fbf8;
  --bg3: #edf7ef;
  --ink: #17351f;
  --line: #217346;
  --paper: #fff;
  --soft: #e8f3ec;
  --warm: #f4fbf6;
  --good: #dff3e7;
  --bad: #ffe7e7;
  --good-strong: #217346;
  --bad-strong: #c43b3b;
  --muted: #4d6556;
  --shadow: 4px 4px 0 rgba(33, 115, 70, .22);
  --radius: 2px;
  --font: Aptos, Calibri, Arial, "Malgun Gothic", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 214, 102, .20), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(88, 166, 255, .14), transparent 30%),
    linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 48%, var(--bg3) 100%);
}

body.theme-retro {
  text-shadow: 0 0 5px rgba(255, 255, 255, .42), 1px 1px 0 rgba(36, 48, 68, .18);
}

body.theme-retro::after,
body.theme-crt::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
}

body.theme-retro::after {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 255, 255, .18), transparent 34%),
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, .10) 0, rgba(255, 255, 255, .10) 1px, transparent 1px, transparent 5px),
    repeating-linear-gradient(90deg, rgba(23, 32, 51, .035) 0, rgba(23, 32, 51, .035) 1px, transparent 1px, transparent 3px);
  opacity: .48;
  mix-blend-mode: soft-light;
}

body.theme-crt::before {
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.08) 0, rgba(255,255,255,.08) 1px, transparent 1px, transparent 4px);
  mix-blend-mode: overlay;
  opacity: .34;
}

button { font: inherit; }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 18px 44px;
}

.app {
  position: relative;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

body.theme-retro .app {
  background: rgba(252,253,251,.82);
  box-shadow: 8px 8px 0 var(--line), 0 0 30px rgba(36,48,68,.12), inset 0 0 34px rgba(255,255,255,.42);
  backdrop-filter: blur(4px) saturate(1.08);
}

.nav {
  min-height: 58px;
  padding: 12px 18px;
  border-bottom: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--soft);
}

.brand {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.theme-switch,
.nav-right,
.person-tabs,
.keyword-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-switch { margin-top: 10px; }
.nav-right { justify-content: flex-end; }

.chip,
.nav-btn,
.theme-btn,
.person-tab,
.keyword-chip {
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.nav-btn,
.theme-btn,
.person-tab,
.keyword-chip {
  box-shadow: 2px 2px 0 var(--line);
}

.nav-btn,
.theme-btn,
.person-tab {
  cursor: pointer;
}

.nav-btn,
.theme-btn {
  background: var(--warm);
}

.theme-btn.is-active,
.person-tab.is-active {
  background: var(--line);
  color: var(--paper);
}

.shell-tabs {
  align-items: flex-end;
  gap: 6px;
  margin: 0 0 -2px 12px;
  position: relative;
  z-index: 2;
  flex-wrap: nowrap;
  max-width: calc(100vw - 36px);
  overflow-x: auto;
  scrollbar-width: none;
}

.shell-tabs::-webkit-scrollbar { display: none; }

.shell-tabs .person-tab {
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid var(--line);
  padding: 10px 15px;
  background: var(--warm);
  color: var(--muted);
}

.shell-tabs .person-tab.is-active {
  background: var(--paper);
  color: var(--ink);
  border-bottom-color: var(--paper);
  transform: translateY(2px);
}

.shell-tabs .person-tab:not(.is-active) {
  transform: translateY(6px);
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
}

.content {
  padding: 22px 28px;
  border-right: 2px solid var(--line);
}

body.theme-excel .content {
  background-image:
    linear-gradient(to right, rgba(33,115,70,.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(33,115,70,.12) 1px, transparent 1px);
  background-size: 76px 34px;
}

.side {
  padding: 18px;
  background: var(--warm);
}

.date {
  display: inline-flex;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--good);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 14px;
}

.source-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--warm);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 18px;
}

.keyword-strip {
  margin: -6px 0 18px;
}

.summary {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.line {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  align-items: stretch;
}

.time-cell,
.line-body,
.vote-panel,
.note,
.day,
.rule-box {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.time-cell {
  background: var(--soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  padding: 8px 6px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

.time-cell span:first-child { font-size: 15px; }
.time-cell span:nth-child(2) { margin-top: 4px; color: var(--muted); font-size: 10px; }

.log-code {
  margin-top: 7px;
  border-top: 2px solid var(--line);
  padding-top: 5px;
  width: 100%;
  font-size: 10px;
}

.line-body {
  padding: 10px 11px;
}

.line-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 900;
}

.mark {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-radius: calc(var(--radius) - 1px);
  background: var(--good);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  flex: 0 0 auto;
}

.line-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.52;
}

.vote-panel {
  padding: 14px;
  box-shadow: 4px 4px 0 var(--line);
  margin-bottom: 18px;
}

.vote-title {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 11px;
}

.votes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 13px;
}

.vote {
  min-height: 58px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 3px 3px 0 var(--line);
  cursor: pointer;
}

.vote.good { background: var(--good); color: var(--ink); }
.vote.bad { background: var(--bad); color: var(--ink); }

.vote.is-selected {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--line);
  outline: 3px solid rgba(36,48,68,.16);
}

.reaction-stamp,
.closed-result {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--warm);
  color: var(--ink);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.45;
  margin-bottom: 12px;
}

.reaction-stamp {
  display: inline-flex;
  opacity: 0;
  transform: rotate(-2deg) scale(.94);
  transition: opacity .16s ease, transform .16s ease;
  pointer-events: none;
}

.vote-panel.has-vote .reaction-stamp {
  opacity: 1;
  transform: rotate(-2deg) scale(1);
}

.closed-result {
  display: block;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 7px;
}

.meter {
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  background: var(--paper);
  margin-bottom: 9px;
}

.meter .good { background: var(--good-strong); }
.meter .bad { flex: 1; background: var(--bad-strong); }

.small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.notes {
  border-top: 2px dashed var(--line);
  padding-top: 16px;
}

h2 {
  margin: 0 0 10px;
  font-size: 17px;
  letter-spacing: 0;
}

.note-list,
.day-list {
  display: grid;
  gap: 10px;
}

.note,
.day,
.rule-box {
  padding: 11px;
}

.note strong,
.day strong {
  display: block;
  font-size: 13px;
  margin-bottom: 5px;
}

.note p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.48;
}

.note a {
  color: var(--line);
  font-size: 12px;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.side-title {
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 9px;
}

.day {
  text-align: left;
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--line);
  cursor: pointer;
}

.day.active {
  background: var(--good);
}

.day span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.rule-box {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.48;
  margin-bottom: 12px;
}

.footer {
  border-top: 2px solid var(--line);
  padding: 12px 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  background: var(--paper);
}

body.theme-retro .app,
body.theme-retro .source-box,
body.theme-retro .time-cell,
body.theme-retro .line-body,
body.theme-retro .vote-panel,
body.theme-retro .note,
body.theme-retro .day,
body.theme-retro .rule-box,
body.theme-retro .footer {
  background-color: rgba(252,253,251,.72);
  box-shadow: inset 0 0 24px rgba(255,255,255,.34), 0 0 12px rgba(88,166,255,.08);
  backdrop-filter: blur(4px) saturate(1.08);
}

body.theme-crt .nav-btn,
body.theme-crt .theme-btn,
body.theme-crt .person-tab,
body.theme-crt .vote-panel {
  box-shadow: 0 0 14px rgba(108,255,159,.16);
}

body.theme-excel .chip,
body.theme-excel .nav-btn,
body.theme-excel .theme-btn,
body.theme-excel .person-tab,
body.theme-excel .keyword-chip {
  border-radius: 2px;
}

@media (max-width: 820px) {
  .wrap { padding: 14px 12px 34px; }
  .app { box-shadow: 5px 5px 0 var(--line); }
  .nav { align-items: flex-start; flex-direction: column; }
  .nav-right { justify-content: flex-start; }
  .main { grid-template-columns: 1fr; }
  .content { border-right: 0; border-bottom: 2px solid var(--line); padding: 18px; }
  .side { padding: 16px; }
  .source-box { align-items: flex-start; flex-direction: column; }
  .line { grid-template-columns: 1fr; }
  .time-cell { min-height: auto; flex-direction: row; justify-content: flex-start; gap: 7px; }
  .time-cell span:nth-child(2) { margin-top: 0; }
  .log-code { margin-top: 0; padding-top: 0; border-top: 0; width: auto; }
}
