/* A paper memo, a wooden shop sign, dots. One warm palette: ink, paper, the red of the found box, the yellow of the hint */
:root {
  --ink: #3a2413; --paper: #fff6df; --paper2: #f4e3bd; --white: #fffdf3; --line: #8a5f36; --red: #b93a2a; --yellow: #ffd84a; --dim: #6e5237;
  --gf-radius: 0; --gf-border: #8a5f36; --gf-surface: #fff6df; --gf-text: #3a2413; --gf-text-dim: #6e5237; --gf-accent: #b93a2a; --gf-title-dim: #6e5237;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2a1c12; color: var(--ink); font: 17px/1.65 "BIZ UDPGothic", "Yu Gothic UI", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#boot { position: fixed; inset: 0; display: grid; place-items: center; color: #f4e3bd; background: #2a1c12; z-index: 9; }

/* frames with a dot-stepped corner */
.card, .box, #memo, #time, #hint-btn, #pause-btn, #guide, #note, #prompt {
  background: var(--paper); box-shadow: inset 0 0 0 4px var(--line);
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
}
.screen { position: fixed; inset: 0; z-index: 5; display: flex; justify-content: center; align-items: flex-start; overflow: auto; touch-action: pan-y; padding: max(5vh, env(safe-area-inset-top)) 16px 24px; background: rgba(30, 18, 8, .42); }
.card { width: min(620px, 100%); padding: 26px 30px; }
.card.wide { width: min(780px, 100%); }
.card h2 { margin: 0; font-size: 27px; line-height: 1.35; }
.card h3 { margin: 0 0 4px; font-size: 16px; color: var(--red); }
.card p { margin: 12px 0; }
.card p b, .tips b { color: var(--red); }
.card img { display: block; width: 100%; height: auto; max-height: 50vh; object-fit: cover; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.no { background: var(--red); color: #fff !important; padding: 2px 12px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.dim { color: var(--dim); font-size: 15px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.col { display: grid; gap: 10px; margin-top: 16px; }
.btn { min-height: 52px; padding: 6px 24px 11px; border: 0; background: var(--paper2); box-shadow: inset 0 0 0 3px var(--line), inset 0 -8px 0 #d3b67c; cursor: pointer; font-weight: 700; touch-action: manipulation; }
.btn.main { background: var(--red); color: #fff; box-shadow: inset 0 0 0 3px #6d1e14, inset 0 -8px 0 #8f2518; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { background: #d9ccb0; color: #6b5c48; box-shadow: inset 0 0 0 3px #a89572; cursor: default; }
.btn.small { min-height: 44px; padding: 2px 14px 8px; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #2f6fb5; outline-offset: -6px; }
.talk { display: flex; gap: 16px; align-items: center; margin: 16px 0; }
.talk p { margin: 0; flex: 1; }
.talk .name { display: block; color: var(--dim); font-size: 15px; }
.face { flex: none; width: 92px; height: 104px; overflow: hidden; position: relative; background: #bcd8c8; }
.face::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--line); }
.face i { position: absolute; left: 0; top: 4px; background-repeat: no-repeat; transform-origin: 0 0; image-rendering: pixelated; }
.memo { background: var(--white); padding: 14px 22px; box-shadow: inset 8px 0 0 var(--yellow); }
.memo ul, #memo ul { list-style: none; margin: 0; padding: 0; }
.memo li { font-size: 23px; font-weight: 700; line-height: 1.5; }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.nums div { background: var(--white); padding: 12px 16px; }
.nums dt { font-size: 14px; color: var(--dim); }
.nums dd { margin: 0; font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 12px; background: #d9c28f; }
.bar i { display: block; height: 100%; width: 0; background: var(--red); }

/* title */
#title { background: linear-gradient(90deg, rgba(30, 18, 8, .5), rgba(30, 18, 8, .08)); justify-content: flex-start; padding-left: max(16px, 5vw); }
#title .box { width: min(570px, 100%); padding: 22px 30px 18px; }
h1 { margin: 0; font-size: clamp(38px, 5vw, 56px); line-height: 1.12; font-weight: 900; }
h1 span { display: inline-block; }
h1 span + span { color: var(--red); }
.lead { margin: 8px 0 12px; }
#modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode { text-align: left; padding: 13px 14px; border: 0; background: var(--paper2); box-shadow: inset 0 0 0 2px #cdb27b; cursor: pointer; display: flex; flex-direction: column; gap: 4px; line-height: 1.4; touch-action: manipulation; }
.mode b { font-size: 19px; }
.mode span { font-size: 14px; }
.mode em { margin-top: auto; padding-top: 4px; font-style: normal; font-size: 14px; color: var(--dim); }
.mode[aria-checked="true"] { background: var(--white); box-shadow: inset 0 0 0 4px var(--red); }
.mode[aria-checked="true"] b { color: var(--red); }
#load { margin-top: 12px; font-size: 15px; }
.go { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
#start-btn { flex: 1 1 200px; font-size: 21px; min-height: 60px; }
#resume-btn { flex: 1 1 100%; }
.links { display: flex; align-items: center; gap: 4px 18px; margin-top: 6px; flex-wrap: wrap; }
.links button { background: none; border: 0; min-height: 44px; padding: 0 2px; text-decoration: underline; cursor: pointer; position: relative; font-size: 15px; }
#rn-dot { position: absolute; right: -9px; top: 9px; width: 8px; height: 8px; background: var(--red); }
#ver { color: var(--dim); font-size: 14px; margin-left: auto; }
body .gf-sharebar { margin-top: 4px; }

/* result, help, pause */
.score { display: grid; grid-template-columns: 1.2fr .8fr 1.2fr; gap: 10px; margin: 16px 0 10px; }
.big { background: var(--white); padding: 12px 16px; }
.big small { display: block; color: var(--dim); font-size: 14px; }
.big strong { font-size: 33px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.big .rank { font-size: 22px; color: var(--red); }
.card .best { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0 16px; font-weight: 700; margin: 8px 0; }
.best span { font-weight: 400; color: var(--ink); }
.best.on { color: var(--red); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 2px dotted #cdb27b; font-variant-numeric: tabular-nums; }
/* the ten rooms: five and five side by side, so that the buttons stay on the screen */
#result table, #result tbody { display: grid; }
#result tbody { grid-template-rows: repeat(5, auto); grid-auto-flow: column; grid-template-columns: 1fr 1fr; gap: 0 20px; }
#result tr { display: grid; grid-template-columns: 1fr auto 5.2em; align-items: center; border-bottom: 2px dotted #cdb27b; line-height: 1.35; }
#result td { border: 0; }
#result td:nth-child(n+2) { text-align: right; white-space: nowrap; padding-left: 0; }
#result td:nth-child(3) { font-size: 14px; color: var(--dim); }
#result td i { display: block; margin: 0; }
#result .slow { background: #fbe3a6; }
td i { font-style: normal; font-size: 14px; color: #9c2c1e; margin-left: 10px; }
#help th { white-space: nowrap; width: 8em; }
.tips { padding-left: 1.2em; margin: 14px 0 0; }
.tips li { margin: 4px 0; }
.set { display: grid; gap: 4px; margin-top: 14px; }
.set label { display: grid; grid-template-columns: 8em 1fr; align-items: center; min-height: 44px; }
.set input { accent-color: var(--red); width: 100%; height: 32px; touch-action: auto; }
.set select { font: inherit; min-height: 44px; background: var(--white); border: 2px solid var(--line); color: var(--ink); padding: 0 10px; }
/* 更新情報 (kit release-notes.js brings no styles of its own) */
.rn-wrap { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: center; align-items: flex-start; padding: max(5vh, env(safe-area-inset-top)) 16px 16px; background: rgba(30, 18, 8, .5); }
.rn-win { width: min(620px, 100%); max-height: 88vh; overflow: auto; background: var(--paper); box-shadow: inset 0 0 0 4px var(--line); padding: 24px 28px; touch-action: pan-y; }
.rn-head { display: flex; align-items: center; gap: 12px; }
.rn-head h2 { margin: 0; flex: 1; font-size: 25px; }
.rn-x { min-width: 48px; min-height: 48px; border: 0; background: var(--paper2); font-size: 22px; cursor: pointer; }
.rn-win summary { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 8px 0; font-weight: 700; cursor: pointer; }
.rn-win summary > * { flex: none; }
.rn-win li > span:first-child, .rn-win li > b:first-child { margin-right: 10px; color: var(--red); font-weight: 700; }
.rn-win ul { padding-left: 1.2em; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; visibility: hidden; z-index: 2; }
.playing #hud { visibility: visible; }
#hud button { pointer-events: auto; touch-action: manipulation; cursor: pointer; }
#memo { position: absolute; left: calc(14px + env(safe-area-inset-left)); top: calc(14px + env(safe-area-inset-top)); padding: 14px 22px 14px 20px; max-width: min(340px, 34vw); }
#memo h3 { margin: 0; font-size: 14px; color: var(--red); }
#memo li { font-size: 20px; font-weight: 700; line-height: 1.45; }
#memo li.done { color: var(--dim); text-decoration: line-through; font-weight: 400; }
#time { position: absolute; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); padding: 12px 24px; text-align: center; display: grid; line-height: 1.3; }
#time span { font-size: 14px; color: var(--dim); white-space: nowrap; }
#clock { font-size: 28px; font-variant-numeric: tabular-nums; }
#corner { position: absolute; right: calc(14px + env(safe-area-inset-right)); top: calc(14px + env(safe-area-inset-top)); display: flex; gap: 8px; align-items: flex-start; }
#hint-btn { border: 0; padding: 13px 18px 15px; min-width: 168px; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 0 10px; line-height: 1.35; background: var(--yellow); }
#hint-btn span { font-weight: 700; }
#hint-btn small { grid-column: 1 / -1; font-size: 14px; }
#hint-btn i { grid-column: 1 / -1; height: 7px; background: #a77d1b; margin-top: 4px; }
#hint-btn u { display: block; height: 100%; background: var(--white); }
#hint-btn.none { background: #d8c9a0; }
#pause-btn { border: 0; width: 54px; height: 54px; display: grid; place-items: center; padding: 0; }
#guide { position: absolute; left: 50%; top: 134px; transform: translateX(-50%); width: min(600px, 90vw); padding: 15px 20px; display: flex; gap: 14px; align-items: center; }
#guide span b, #note b { color: var(--red); }
#note { position: absolute; left: 50%; bottom: 17%; transform: translateX(-50%); opacity: 0; width: max-content; max-width: min(640px, 90vw); padding: 14px 22px; transition: opacity .15s; }
#note.on { opacity: 1; }
#note.good { background: #fff0b0; }
#note.bad { background: #ffe0d6; }
#cross { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; background: #fff; box-shadow: 0 0 0 2px rgba(40, 24, 10, .75); }
#cross.on { background: var(--yellow); width: 12px; height: 12px; margin: -6px; }
#cross.hold { background: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(40, 24, 10, .75); }
#prompt { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); padding: 12px 18px; text-align: center; display: grid; white-space: nowrap; line-height: 1.45; font-size: 15px; }
#prompt b { font-size: 18px; }
kbd { font: inherit; font-size: 13px; font-weight: 700; background: var(--ink); color: #fff; padding: 1px 7px; }
#beacon { position: absolute; left: 0; top: 0; filter: drop-shadow(0 0 2px #3a2413); --c: linear-gradient(var(--yellow), var(--yellow)); background: var(--c) 0 0 / 30% 5px, var(--c) 0 0 / 5px 30%, var(--c) 100% 0 / 30% 5px, var(--c) 100% 0 / 5px 30%, var(--c) 0 100% / 30% 5px, var(--c) 0 100% / 5px 30%, var(--c) 100% 100% / 30% 5px, var(--c) 100% 100% / 5px 30%; background-repeat: no-repeat; }
#arrow { position: absolute; left: 0; top: 0; width: 56px; height: 56px; }
#arrow svg { width: 100%; height: 100%; }
/* the kit's own line about the mouse: under the clock, only in play */
#room-no:not(:empty) { margin-right: .6em; }
.kit-look-note { top: auto !important; bottom: 14px; border-radius: 0 !important; }
body:not(.playing) .kit-look-note { display: none !important; }
#pad { display: none; }
.touch #pad { display: block; }
#stick { position: absolute; left: calc(26px + env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom)); width: 124px; height: 124px; border-radius: 50%; background: rgba(255, 246, 223, .35); box-shadow: inset 0 0 0 3px rgba(255, 246, 223, .8); pointer-events: auto; touch-action: none; }
#knob { position: absolute; left: calc(50% - 27px); top: calc(50% - 27px); width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 246, 223, .85); }
#btns { position: absolute; right: calc(18px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: auto auto; gap: 10px; justify-items: end; align-items: end; }
#btns button { border: 0; min-width: 96px; height: 62px; padding: 0 12px; background: rgba(255, 246, 223, .88); box-shadow: inset 0 0 0 3px var(--line); font-weight: 700; font-size: 15px; }
#btns #b-take { background: var(--red); color: #fff; box-shadow: inset 0 0 0 3px #6d1e14; height: 72px; font-size: 18px; }
#b-low { grid-column: 2; }
#btns #b-low.on { background: var(--yellow); }

/* phones: the short side under 500 px */
@media (max-width: 499px), (max-height: 499px) {
  .screen { padding: max(8px, env(safe-area-inset-top)) 8px 12px; }
  .card, #title .box { padding: 18px; }
  .card h2 { font-size: 23px; }
  .memo li { font-size: 21px; }
  #memo { padding: 12px 16px; max-width: 34vw; }
  #memo li { font-size: 17px; line-height: 1.35; }
  #time { padding: 12px 16px; }
  #clock { font-size: 21px; line-height: 1.2; }
  #total { display: none; }
  #hint-btn { min-width: 138px; padding: 12px 14px 13px; }
  #guide { font-size: 17px; top: 100px; }
  #note { bottom: 24%; }
  .nums dd { font-size: 20px; }
  .nums div { padding: 10px 12px; }
  .big strong { font-size: 25px; }
  .big .rank { font-size: 18px; }
  .set label { grid-template-columns: 6.5em 1fr; }
}
@media (max-width: 499px) {
  #modes { grid-template-columns: 1fr; }
  .mode { display: grid; grid-template-columns: auto 1fr; gap: 0 12px; }
  .mode span { grid-column: 1 / -1; }
  .mode em { grid-row: 1; grid-column: 2; justify-self: end; align-self: center; margin: 0; padding: 0; text-align: right; }
  .mode em br { display: none; }
  .score { grid-template-columns: 1fr 1fr; }
  .score .big:last-child { grid-column: 1 / -1; }
  #result tbody { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: 1fr; }
  #room-name { display: none; }
  #room-name:only-child, #room-no:empty + #room-name { display: inline; }
  #time { left: calc(10px + env(safe-area-inset-left)); transform: none; text-align: left; }
  #corner { right: 10px; }
  #memo { left: 10px; max-width: calc(100vw - 20px); top: calc(104px + env(safe-area-inset-top)); }
  #guide { top: 210px; }
  #prompt { white-space: normal; width: max-content; max-width: 78vw; }
  #note { bottom: 190px; }
  .nums { grid-template-columns: 1fr 1fr; }
}
@media (max-height: 499px) {
  #title { padding-left: max(12px, env(safe-area-inset-left)); }
  #title .box { width: min(700px, 100%); }
  h1 { font-size: 32px; }
  .lead { margin: 2px 0 8px; }
  #guide { width: min(420px, 48vw); top: 94px; }
  #stick { width: 108px; height: 108px; }
  #btns button { height: 52px; }
  #btns #b-take { height: 58px; }
  #note { bottom: 8px; max-width: 46vw; }
  #prompt { top: calc(50% + 20px); display: flex; gap: 10px; align-items: baseline; padding: 9px 16px; }
}
