/* GRID PRESS / 格间日报 — shared tactile editorial game skin */
:root {
  --paper: #eee6d4;
  --paper-light: #f8f2e4;
  --paper-deep: #d8ccb3;
  --ink: #173047;
  --ink-soft: #465663;
  --teal: #176a70;
  --ochre: #bd851d;
  --graphite: #5d5c57;
  --proof: #9b382c;
  --hairline: rgba(23, 48, 71, .42);
  --lift: 0 2px 0 rgba(63, 49, 30, .28), 0 7px 14px rgba(63, 49, 30, .12);
  --serif: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", SimSun, serif;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    linear-gradient(rgba(32, 25, 17, .08), rgba(32, 25, 17, .08)),
    #796b55;
  font-family: var(--serif);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input { font: inherit; }
button { color: inherit; }
.hide { display: none !important; }

#press-app {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 12px;
  isolation: isolate;
}

#press-app::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .09;
  z-index: 20;
  background-image:
    repeating-radial-gradient(circle at 17% 29%, rgba(64, 45, 21, .13) 0 1px, transparent 1px 5px),
    repeating-radial-gradient(circle at 73% 61%, rgba(255,255,255,.19) 0 1px, transparent 1px 7px);
  background-size: 143px 151px, 181px 173px;
  mix-blend-mode: multiply;
}

.workspace {
  width: min(1180px, 100%);
  min-height: min(780px, calc(100dvh - 24px));
  display: grid;
  grid-template-columns: 174px minmax(480px, 1fr) 286px;
  position: relative;
  filter: drop-shadow(0 18px 24px rgba(33, 25, 15, .28));
}

.spine {
  position: relative;
  min-width: 0;
  padding: 34px 25px;
  color: var(--paper-light);
  background:
    linear-gradient(90deg, rgba(255,255,255,.04), transparent 12%, transparent 88%, rgba(0,0,0,.2)),
    var(--ink);
  border-radius: 12px 0 0 12px;
  border-right: 3px double rgba(238, 230, 212, .32);
  overflow: hidden;
}
.spine::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(87deg, transparent 0 6px, rgba(255,255,255,.025) 6px 7px);
}
.edition-mark { font-size: 11px; letter-spacing: .28em; opacity: .82; }
.brand-vertical {
  margin: 26px 0 34px;
  font-size: clamp(29px, 3.1vw, 45px);
  line-height: .94;
  letter-spacing: .12em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  height: 305px;
}
.edition-zh .brand-vertical { letter-spacing: .23em; }
.spine-nav { display: grid; gap: 4px; position: relative; z-index: 2; }
.spine-nav button, .spine-link {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(238,230,212,.28);
  background: transparent;
  color: inherit;
  padding: 12px 2px 9px;
  text-align: left;
  letter-spacing: .12em;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  position: relative;
}
.spine-nav button.active::after {
  content: "";
  width: 7px;
  height: 7px;
  position: absolute;
  right: 4px;
  top: 16px;
  background: var(--proof);
  transform: rotate(45deg);
}
.spine-link { margin-top: 16px; opacity: .78; }
.spine-link:hover { opacity: 1; }

.paper {
  position: relative;
  min-width: 0;
  padding: 24px clamp(22px, 4vw, 52px) 20px;
  background:
    radial-gradient(ellipse at 23% 15%, rgba(255,255,255,.48), transparent 34%),
    radial-gradient(ellipse at 76% 84%, rgba(152,122,75,.07), transparent 38%),
    var(--paper);
  border: 1px solid rgba(92, 72, 45, .35);
  box-shadow: inset 14px 0 20px rgba(83, 64, 37, .08), inset -1px 0 rgba(255,255,255,.7);
  z-index: 2;
}
.paper::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(23,48,71,.18);
  pointer-events: none;
}

.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.issue-label { font-size: 10px; letter-spacing: .16em; line-height: 1.6; border-bottom: 1px solid var(--ink); width: fit-content; }
.masthead-title { text-align: center; }
.masthead-title h1 { margin: 0; font-size: clamp(28px, 4vw, 47px); font-weight: 600; letter-spacing: .13em; line-height: 1; }
.masthead-title p { margin: 8px 0 0; font-size: 12px; letter-spacing: .32em; }
.head-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 7px;
  color: inherit;
  text-decoration: none;
}
.icon-btn:hover, .icon-btn:focus-visible { border-color: var(--hairline); background: rgba(255,255,255,.16); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; }

.week-strip {
  margin: 17px auto 14px;
  max-width: 560px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  position: relative;
  z-index: 1;
}
.day-stamp { text-align: center; font-size: 8px; letter-spacing: .08em; opacity: .56; }
.day-stamp span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin: 4px auto 0;
  border: 1px dashed var(--hairline);
}
.day-stamp.done span { border: 2px solid var(--teal); border-radius: 50%; background: rgba(23,106,112,.09); }
.day-stamp.today { opacity: 1; font-weight: 700; }
.day-stamp.today span { border-style: solid; }

.rule { height: 9px; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rule::before, .rule::after { content: ""; height: 1px; background: var(--hairline); flex: 1; }
.rule i { width: 7px; height: 7px; background: var(--ink); transform: rotate(45deg); }

.board-wrap { position: relative; z-index: 1; }
.board {
  --tile-size: clamp(42px, 6.1vw, 63px);
  display: grid;
  grid-template-columns: repeat(var(--columns), var(--tile-size));
  grid-template-rows: repeat(6, var(--tile-size));
  gap: clamp(6px, .8vw, 10px);
  justify-content: center;
  perspective: 900px;
}
.edition-zh .board { --tile-size: clamp(48px, 7vw, 68px); }
.tile {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23,48,71,.48);
  background: rgba(248,242,228,.52);
  box-shadow: 0 1px 0 rgba(255,255,255,.7), 0 2px 2px rgba(57,43,24,.13);
  font-size: clamp(24px, 4.4vw, 39px);
  font-weight: 600;
  text-transform: uppercase;
  transform-style: preserve-3d;
  transition: transform .14s cubic-bezier(.2,.8,.2,1), background .18s;
}
.edition-zh .tile { font-family: var(--serif); font-size: clamp(25px, 4.4vw, 38px); }
.tile.filled { transform: translateY(-1px); box-shadow: var(--lift); }
.tile.reveal { animation: tile-flip .46s cubic-bezier(.2,.7,.25,1) both; animation-delay: calc(var(--i) * 70ms); }
.tile.correct, .tile.present, .tile.absent { color: var(--paper-light); border-color: rgba(38,32,25,.44); }
.tile.correct { background: var(--teal); }
.tile.present { background: var(--ochre); background-image: repeating-linear-gradient(125deg, transparent 0 6px, rgba(23,48,71,.18) 6px 7px); }
.tile.absent { background: var(--graphite); }
.tile .mark { position: absolute; bottom: 4px; font-family: var(--sans); font-size: 9px; letter-spacing: -1px; opacity: .92; }
.row-shake { animation: shake .31s ease both; }

.game-status { text-align: center; min-height: 29px; padding: 10px 0 4px; font-size: 11px; letter-spacing: .14em; }
.game-status.error { color: var(--proof); }

.keyboard { display: grid; gap: 7px; max-width: 650px; margin: 4px auto 0; position: relative; z-index: 1; }
.key-row { display: flex; justify-content: center; gap: 6px; }
.key {
  height: 45px;
  min-width: 34px;
  flex: 1 1 0;
  max-width: 52px;
  border: 1px solid rgba(69,55,35,.28);
  border-radius: 2px 2px 4px 3px;
  background: var(--paper-light);
  box-shadow: 0 2px 0 rgba(70,54,31,.33), 0 5px 8px rgba(70,54,31,.11);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.key.wide { flex-grow: 1.55; max-width: 78px; font-size: 11px; letter-spacing: .05em; }
.key:hover { background: #fffaf0; }
.key:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(70,54,31,.25); }
.key.correct { background: var(--teal); color: var(--paper-light); }
.key.present { background: var(--ochre); color: var(--paper-light); }
.key.absent { background: var(--graphite); color: var(--paper-light); }

.idiom-input { max-width: 630px; margin: 6px auto 0; position: relative; z-index: 2; }
.catalog-search {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 52px;
  background: #f3ead6;
  border: 1px solid rgba(23,48,71,.42);
  box-shadow: var(--lift);
}
.catalog-search label { align-self: stretch; display: grid; place-items: center; padding: 0 14px; color: var(--paper-light); background: var(--ink); font-size: 11px; letter-spacing: .12em; }
.catalog-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 10px 14px; font-family: var(--sans); font-size: 20px; letter-spacing: .06em; }
.catalog-search button { align-self: stretch; width: 48px; border: 0; border-left: 1px solid var(--hairline); background: transparent; cursor: pointer; font-size: 21px; }
.candidate-list { display: grid; width: calc(100% - 42px); margin: 7px auto 0; filter: drop-shadow(0 5px 5px rgba(56,40,19,.13)); }
.candidate {
  min-height: 37px;
  border: 1px solid rgba(110,79,37,.24);
  border-bottom: 0;
  background: #ebdfc6;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: .2em;
  font-size: 16px;
  transform: rotate(var(--tilt, 0deg));
}
.candidate:last-child { border-bottom: 1px solid rgba(110,79,37,.24); }
.candidate:hover, .candidate.selected { color: var(--proof); background: #f5ead2; }
.search-helper { text-align: center; font-family: var(--sans); font-size: 11px; margin: 7px 0 0; color: var(--ink-soft); }
.submit-idiom {
  display: block;
  width: 100%;
  margin-top: 8px;
  min-height: 43px;
  border: 0;
  background: var(--ink);
  color: var(--paper-light);
  letter-spacing: .2em;
  cursor: pointer;
  box-shadow: 0 3px 0 #0b1e2d;
}
.submit-idiom:active { transform: translateY(2px); box-shadow: 0 1px 0 #0b1e2d; }

.notes {
  align-self: center;
  margin-left: 18px;
  padding: 42px 28px 32px;
  min-height: 620px;
  background: #e9dec7;
  border: 1px solid rgba(82,61,32,.35);
  transform: rotate(.55deg);
  box-shadow: 0 9px 18px rgba(42,31,18,.22);
  position: relative;
}
.notes::before { content: ""; width: 17px; height: 17px; position: absolute; top: 12px; left: 50%; border-radius: 50%; background: #7c5d29; box-shadow: inset -3px -3px 4px rgba(0,0,0,.32), 0 3px 5px rgba(0,0,0,.2); }
.notes h2 { margin: 0 0 8px; font-size: 13px; letter-spacing: .19em; border-bottom: 1px solid var(--hairline); padding-bottom: 9px; }
.notes-section { padding: 17px 0; border-bottom: 1px solid rgba(23,48,71,.28); }
.notes-section:last-child { border-bottom: 0; }
.notes-kicker { display: block; font-size: 9px; font-weight: 700; letter-spacing: .16em; margin-bottom: 9px; }
.legend-row { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 8px; margin: 7px 0; font-size: 11px; }
.legend-swatch { width: 19px; height: 19px; display: grid; place-items: center; color: var(--paper-light); font-size: 9px; }
.legend-swatch.correct { background: var(--teal); }
.legend-swatch.present { background: var(--ochre); }
.legend-swatch.absent { background: var(--graphite); }
.objective { font-size: 21px; font-style: italic; line-height: 1.25; }
.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; font-family: var(--sans); }
.mini-stats strong { display: block; font-family: var(--serif); font-size: 24px; font-weight: 500; }
.mini-stats span { font-size: 9px; letter-spacing: .1em; }
.hint-ticket { border: 1px dashed rgba(23,48,71,.45); padding: 13px; background: rgba(248,242,228,.64); font-size: 12px; line-height: 1.45; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  transform: translate(-50%, 15px);
  opacity: 0;
  padding: 11px 18px;
  background: var(--ink);
  color: var(--paper-light);
  box-shadow: var(--lift);
  font-family: var(--sans);
  font-size: 12px;
  transition: transform .22s, opacity .22s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31,24,15,.58);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s, visibility .22s;
  overflow: auto;
}
.overlay.show { opacity: 1; visibility: visible; }
.result-sheet, .modal-sheet {
  width: min(500px, 100%);
  background: var(--paper-light);
  color: var(--ink);
  border: 1px solid rgba(67,50,29,.32);
  padding: 31px clamp(24px, 6vw, 46px);
  box-shadow: 0 20px 45px rgba(35,25,13,.35);
  transform: rotate(-.35deg) translateY(15px);
  transition: transform .28s cubic-bezier(.16,1,.3,1);
  position: relative;
}
.overlay.show .result-sheet, .overlay.show .modal-sheet { transform: rotate(-.35deg) translateY(0); }
.modal-sheet { transform: none; max-height: min(720px, calc(100dvh - 40px)); overflow: auto; }
.overlay.show .modal-sheet { transform: none; }
.close-sheet { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; background: transparent; font-size: 24px; cursor: pointer; }
.result-kicker { text-align: center; letter-spacing: .16em; font-size: 10px; }
.result-title { text-align: center; margin: 12px 0 18px; font-size: clamp(30px, 7vw, 45px); font-weight: 500; letter-spacing: .06em; }
.share-grid { display: grid; gap: 5px; width: fit-content; margin: 0 auto 18px; }
.share-row { display: flex; gap: 5px; }
.share-cell { width: 28px; height: 28px; }
.share-cell.correct { background: var(--teal); }
.share-cell.present { background: var(--ochre); }
.share-cell.absent { background: var(--graphite); }
.proof-stamp {
  position: absolute;
  right: 17px;
  top: 156px;
  width: 90px;
  height: 90px;
  border: 4px double var(--proof);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--proof);
  font-weight: 700;
  letter-spacing: .05em;
  transform: rotate(-12deg) scale(0);
  opacity: .9;
}
.overlay.show .proof-stamp { animation: stamp-in .48s .2s cubic-bezier(.18,1.45,.38,1) forwards; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); margin: 18px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); padding: 14px 0; }
.result-stats div { text-align: center; border-right: 1px solid var(--hairline); }
.result-stats div:last-child { border: 0; }
.result-stats strong { display: block; font-size: 27px; font-weight: 500; }
.result-stats span { font-size: 9px; letter-spacing: .12em; }
.definition-slip { margin: 14px 0; padding: 11px 0; border-bottom: 1px dashed var(--hairline); font-size: 13px; line-height: 1.5; }
.definition-slip strong { display: block; color: var(--teal); letter-spacing: .1em; margin-bottom: 3px; }
.paper-btn {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--ink);
  margin-top: 9px;
  background: transparent;
  color: var(--ink);
  letter-spacing: .12em;
  font-weight: 700;
  cursor: pointer;
}
.paper-btn.primary { color: var(--paper-light); background: var(--ink); box-shadow: 0 3px 0 #0b1e2d; }
.paper-btn:active { transform: translateY(2px); }
.score-submit { margin-top: 16px; border-top: 1px solid var(--hairline); padding-top: 14px; font-family: var(--sans); }
.score-submit label { display: block; font-size: 11px; margin-bottom: 6px; }
.score-submit input { width: 100%; min-height: 40px; border: 1px solid var(--hairline); background: #fffaf0; padding: 8px 10px; color: var(--ink); }
.submit-status { min-height: 18px; font-size: 11px; margin-top: 7px; }
.stats-table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.stats-table th, .stats-table td { padding: 10px 4px; text-align: left; border-bottom: 1px solid rgba(23,48,71,.2); }
.stats-table td { text-align: right; font-family: var(--sans); }
.distribution { display: grid; gap: 7px; margin-top: 18px; }
.dist-row { display: grid; grid-template-columns: 18px 1fr 28px; gap: 8px; align-items: center; font-family: var(--sans); font-size: 11px; }
.dist-track { height: 18px; background: rgba(23,48,71,.08); }
.dist-fill { height: 100%; min-width: 3px; background: var(--teal); }

@keyframes tile-flip { 0% { transform: rotateX(0); } 48% { transform: rotateX(88deg); } 52% { transform: rotateX(88deg); } 100% { transform: rotateX(0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@keyframes stamp-in { from { transform: rotate(-20deg) scale(1.7); opacity: 0; } to { transform: rotate(-12deg) scale(1); opacity: .9; } }

@media (max-width: 980px) {
  #press-app { padding: 0; display: block; }
  .workspace { width: 100%; min-height: 100dvh; display: block; filter: none; }
  .spine {
    min-height: 82px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    border-radius: 0;
    border-right: 0;
    border-bottom: 3px double rgba(238,230,212,.32);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .edition-mark { display: none; }
  .brand-vertical { writing-mode: horizontal-tb; height: auto; margin: 0; font-size: 23px; letter-spacing: .11em; }
  .spine-nav { display: flex; align-items: center; gap: 10px; }
  .spine-nav button, .spine-link { width: auto; padding: 8px 3px; border: 0; font-size: 10px; margin: 0; }
  .spine-nav button.active::after { top: auto; bottom: 0; left: 50%; right: auto; width: 5px; height: 5px; }
  .paper { min-height: calc(100dvh - 82px); padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border: 0; box-shadow: none; }
  .paper::after { inset: 6px; }
  .notes { display: none; }
  .masthead { grid-template-columns: 1fr auto; }
  .masthead-title { grid-column: 1 / -1; grid-row: 1; }
  .issue-label { grid-row: 2; margin-top: 7px; }
  .head-actions { grid-row: 2; }
  .week-strip { margin: 10px auto 9px; gap: 3px; }
  .day-stamp { font-size: 7px; }
  .day-stamp span { width: 21px; height: 21px; }
  .rule { margin-bottom: 7px; }
  .board { --tile-size: min(12.5vw, 55px); gap: min(2vw, 8px); }
  .edition-zh .board { --tile-size: min(13.8vw, 60px); }
  .game-status { padding-top: 7px; min-height: 24px; }
  .key-row { gap: 4px; }
  .key { min-width: 0; height: 43px; font-size: 14px; }
  .key.wide { font-size: 9px; }
  .catalog-search { min-height: 46px; }
  .candidate { min-height: 34px; }
}

@media (max-width: 420px) {
  .spine { min-height: 68px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .spine-link { display: none; }
  .paper { min-height: calc(100dvh - 68px); padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
  .masthead-title h1 { font-size: 25px; }
  .masthead-title p { margin-top: 4px; font-size: 9px; }
  .issue-label { font-size: 8px; }
  .icon-btn { width: 31px; height: 31px; padding: 6px; }
  .week-strip { margin-top: 7px; }
  .day-stamp span { margin-top: 2px; }
  .board { --tile-size: min(12vw, 49px); gap: 5px; }
  .edition-zh .board { --tile-size: min(13.4vw, 55px); }
  .tile { font-size: 23px; }
  .edition-zh .tile { font-size: 25px; }
  .keyboard { gap: 5px; }
  .key-row { gap: 3px; }
  .key { height: 39px; font-size: 13px; }
  .game-status { font-size: 9px; padding: 5px 0 2px; }
  .catalog-search input { font-size: 17px; padding: 8px 9px; }
  .catalog-search label { padding: 0 9px; font-size: 9px; }
  .candidate-list { width: calc(100% - 24px); }
  .candidate { min-height: 31px; font-size: 14px; }
  .candidate:nth-child(n + 5) { display: none; }
  .search-helper { font-size: 9px; margin-top: 4px; }
  .submit-idiom { min-height: 38px; margin-top: 5px; }
}

@media (max-height: 760px) and (max-width: 980px) {
  .week-strip { display: none; }
  .rule { margin-top: 5px; }
  .board { --tile-size: min(10.7vh, 48px); gap: 5px; }
  .edition-zh .board { --tile-size: min(10.6vh, 53px); }
  .key { height: 37px; }
  .candidate { min-height: 29px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
