body { padding: 0; margin: 0; overflow: hidden; overscroll-behavior: none }
#unity-container { position: fixed; width: 100%; height: 100%; }
/* touch-action: none keeps the joystick drag from scrolling or zooming the page, and no callout
   or selection appears while a thumb rests on a button */
#unity-canvas { width: 100%; height: 100%; background: #231F20; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent }
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
#unity-progress-bar-empty { margin-left: auto; margin-right: auto; width: 141px; height: 18px; margin-top: 10px; background: url('progress-bar-empty-dark.png') no-repeat center }
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
#unity-loading-bar.waiting #unity-progress-bar-empty { visibility: hidden }
#start-button { position: absolute; left: 50%; top: 142px; transform: translateX(-50%); width: 288px; height: 96px; padding: 0; border: 0; background: url('start-button.png') 0 0 / 576px 96px no-repeat; image-rendering: pixelated; cursor: pointer }
#start-button:hover { filter: brightness(1.05) }
#start-button:active { background-position: -288px 0 }
#start-button:focus-visible { outline: 3px solid #FFFFFF; outline-offset: -4px }
#start-character { position: absolute; left: calc(50% - 240px); top: 130px; width: 144px; height: 144px; background: url('start-character.png') 0 0 / 288px 144px no-repeat; image-rendering: pixelated; animation: start-character-dig 0.8s steps(2) infinite }
#unity-loading-bar:not(.waiting) #start-character { left: calc(50% - 180px); top: 62px }
@keyframes start-character-dig { to { background-position: -288px 0 } }
@media (prefers-reduced-motion: reduce) { #start-character { animation: none } }
#start-hint { position: absolute; left: 50%; top: 250px; transform: translateX(-50%); margin: 0; white-space: nowrap; font: 13px -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; color: #BDB7B8 }
/* Galmuri11 (SIL OFL; license in the font file) - the pixel font the game falls back to for Korean */
@font-face { font-family: "Galmuri11"; src: url('fonts/Galmuri11.ttf') format('truetype'); font-display: swap }
#result-overlay { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(35, 31, 32, 0.55); font-family: "Galmuri11", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; color: #643F40 }
#result-overlay[hidden] { display: none }
#result-overlay img, #result-overlay .result-portrait { image-rendering: pixelated }
/* Panel: the game dialog box's wooden frame, 9-sliced at 3x */
.result-panel { box-sizing: border-box; width: min(560px, 100%); max-height: 100%; overflow-y: auto; padding: 4px 12px 12px; border: 24px solid transparent; border-image: url('ui/panel.png') 8 / 24px stretch; background: #DCB98A padding-box; image-rendering: pixelated }
.result-head { display: flex; align-items: center }
.result-portrait { position: relative; flex: none; width: 144px; height: 144px; background: url('ui/portrait-frame.png') 0 0 / 144px 144px no-repeat }
.result-face { position: absolute; left: 24px; top: 24px; width: 96px; height: 96px }
/* Speech bubble next to the portrait, like the in-game dialogue */
.result-bubble { flex: 1; min-width: 0; box-sizing: border-box; min-height: 144px; margin-left: -3px; display: flex; flex-direction: column; justify-content: center; border-style: solid; border-width: 33px 18px 36px 30px; border-image: url('ui/bubble.png') 11 6 12 10 fill / 33px 18px 36px 30px stretch }
.result-bubble h2 { margin: 0; font-size: 22px; font-weight: normal }
.result-total { margin: 4px 0 0; font-size: 28px }
/* Cream boxes and buttons: the Square Buttons sprites, 9-sliced at 3x */
.result-box { margin-top: 12px; padding: 0 6px; border-style: solid; border-width: 12px 12px 15px; border-image: url('ui/button.png') 4 4 5 fill / 12px 12px 15px stretch }
.result-box h3 { margin: 0 0 6px; font-size: 18px; font-weight: normal }
.result-breakdown { margin: 0 }
.result-row { display: grid; grid-template-columns: 1fr auto 80px; gap: 8px; padding: 3px 0; font-size: 16px }
.result-row dt, .result-row dd { margin: 0 }
.result-detail { color: #8A6A5C }
.result-points { text-align: right; font-variant-numeric: tabular-nums }
.result-form { display: flex; gap: 8px; margin-top: 12px }
.result-field { flex: 1; min-width: 0; padding: 0 6px; font: inherit; font-size: 18px; color: #643F40; background: none; border-style: solid; border-width: 12px 12px 15px; border-image: url('ui/field.png') 4 4 5 fill / 12px 12px 15px stretch }
.result-field:focus { outline: none; filter: brightness(1.04) }
.result-button { padding: 0 8px; font: inherit; font-size: 18px; color: #643F40; background: none; cursor: pointer; border-style: solid; border-width: 12px 12px 15px; border-image: url('ui/button.png') 4 4 5 fill / 12px 12px 15px stretch }
.result-button:active:not(:disabled) { border-image-source: url('ui/button-pressed.png') }
.result-button:disabled { opacity: 0.55; cursor: default }
.result-button:focus-visible, .result-field:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 2px }
.result-message { min-height: 1.3em; margin: 8px 4px 0; font-size: 16px }
.result-list { margin: 0; padding: 0; list-style: none }
.result-list li { display: grid; grid-template-columns: 30px 44px 1fr auto 80px; align-items: center; gap: 6px; min-height: 30px; padding: 2px 4px; font-size: 16px }
.result-list li.is-mine { background: rgba(255, 255, 255, 0.55) }
.result-list li.result-empty { display: block; color: #8A6A5C }
.result-star { width: 24px; height: 24px }
.result-rank { color: #8A6A5C }
.result-badge { font-size: 13px; color: #4F7A3A }
.result-score { text-align: right; font-variant-numeric: tabular-nums }
.result-close { display: block; width: 100%; margin-top: 12px }
/* Landscape phones are short: the result panel uses the small layout there too, so the name
   field still fits above the on-screen keyboard */
@media (max-width: 480px), (max-height: 500px) {
  .result-panel { padding: 0 6px 8px; border-width: 16px; border-image-width: 16px }
  .result-portrait { width: 96px; height: 96px; background-size: 96px 96px }
  .result-face { left: 16px; top: 16px; width: 64px; height: 64px }
  .result-bubble { min-height: 96px; border-width: 22px 12px 24px 20px; border-image-width: 22px 12px 24px 20px }
  .result-bubble h2 { font-size: 16px }
  .result-total { font-size: 20px }
  .result-row, .result-list li { font-size: 14px }
  .result-list li { grid-template-columns: 26px 36px 1fr auto 64px }
}
/* Rotate hint: touch screens held upright. The result overlay stays usable upright, since typing a
   name is easier that way. */
#rotate-hint { display: none; position: fixed; inset: 0; z-index: 20; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: #231F20; font-family: "Galmuri11", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; font-size: 18px; color: #F3E3C3 }
#rotate-hint p { margin: 0 }
#rotate-phone { width: 48px; height: 80px; box-sizing: border-box; border: 6px solid #F3E3C3; border-radius: 8px; animation: rotate-phone 1.6s ease-in-out infinite }
@keyframes rotate-phone { 0%, 20% { transform: rotate(0) } 60%, 100% { transform: rotate(-90deg) } }
@media (prefers-reduced-motion: reduce) { #rotate-phone { animation: none; transform: rotate(-90deg) } }
@media (pointer: coarse) and (orientation: portrait) {
  #rotate-hint { display: flex }
  body:has(#result-overlay:not([hidden])) #rotate-hint { display: none }
}
