@font-face {
  font-family: "Dday Seongsil";
  src: url("./assets/nanum-seongsil.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: dark;
  font-family: "Dday Seongsil", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px;
  font-synthesis: none;
  color: #fffaf1;
  background: #101b23;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.page-shell, .workspace, .board { width: 100%; height: 100%; margin: 0; padding: 0; }
.photo-stage { position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; background: #233440; isolation: isolate; }
.photo-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--columns, 8), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 5), minmax(0, 1fr)); gap: clamp(2px, .25vw, 4px); background: #13222a; }
.board-cell { position: relative; display: block; min-width: 0; min-height: 0; padding: 0; border: 0; overflow: hidden; background: #2f424b; cursor: pointer; perspective: 700px; }
.board-cell > img, .tile-flip { display: block; width: 100%; height: 100%; object-fit: cover; }
.board-cell > img { filter: saturate(.9); }
.board-cell:hover > img { filter: saturate(1.1); }
.tile-flip { position: absolute; inset: 0; transform-origin: center top; backface-visibility: hidden; pointer-events: none; box-shadow: 0 8px 16px #0008; }
.tile-flip.turn { animation: tile-turn .64s cubic-bezier(.47,.05,.3,1) forwards; }
@keyframes tile-turn { 0% { transform: rotateX(0deg); opacity: 1; } 70% { opacity: 1; filter: brightness(.55); } 100% { transform: rotateX(-105deg); opacity: 0; } }
.settings-open { position: fixed; z-index: 5; bottom: max(16px, env(safe-area-inset-bottom)); right: max(18px, env(safe-area-inset-right)); min-width: 64px; min-height: 44px; padding: 9px 16px; border: 1px solid #ffffff35; border-radius: 999px; background: transparent; color: white; font-size: 1.1rem; opacity: .18; transition: opacity .2s, background .2s; }
.settings-open:hover, .settings-open:focus-visible, .settings-open:active { opacity: 1; background: #12222a70; }
/* Numbers occupy the same rectangles as their photo tiles. */
.countdown-overlay { position: absolute; z-index: 3; inset: 0; text-align: center; pointer-events: none; text-shadow: 0 3px 5px #000, 0 0 18px #000; }
.countdown-heading { position: absolute; inset: 0; }
.countdown-overlay h1, .target-description { position: absolute; display: flex; align-items: center; justify-content: center; margin: 0; padding: 8px; font-weight: 400; line-height: 1.08; overflow-wrap: anywhere; }
.heading-text { display: block; min-width: 0; max-width: 100%; }
.date-part { display: block; white-space: nowrap; }
.target-description { color: #fff4e6; }
.day-line { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px; }
#day-label { font-weight: 400; line-height: .95; color: #fffaf1; white-space: nowrap; }
#status-label { color: #ffd19a; white-space: nowrap; line-height: 1.1; }
.timer-grid { position: absolute; inset: 0; }
.time-unit { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px; }
.time-unit strong { font-variant-numeric: tabular-nums; font-size: var(--number-size, 5rem); font-weight: 400; line-height: .95; white-space: nowrap; }
.time-unit span { color: #fffaf1; font-size: clamp(1rem, 2vw, 1.65rem); line-height: 1.1; }
.empty-photo { position: absolute; z-index: 3; bottom: 30px; left: 20px; right: 20px; text-align: center; }
.empty-photo p { margin: 4px 0; }
#settings-dialog { width: min(820px, calc(100% - 28px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); padding: clamp(18px, 3vw, 30px); border: 1px solid #ffffff30; border-radius: 16px; background: #101b23; color: #f7f3eb; overflow: auto; overscroll-behavior: contain; box-shadow: 0 24px 90px #0009; }
#settings-dialog::backdrop { background: #060d14b8; backdrop-filter: blur(7px); }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.settings-heading h2 { margin: 0; font-size: 2rem; font-weight: 400; }
.dialog-close { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; font-family: sans-serif; font-size: 1.7rem; background: #ffffff12; color: white; }
.dialog-close:disabled { opacity: .4; cursor: default; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.login-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.login-form label { grid-column: 1 / -1; font-size: 1.2rem; }
.login-form input, .field input { width: 100%; min-width: 0; height: 48px; padding: 0 12px; border: 1px solid #ffffff45; border-radius: 5px; outline: none; color: white; background: #1b2c36; }
.login-form input { font-family: system-ui, sans-serif; }
.login-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; color: #f4ba7b; font-size: 1.1rem; }
fieldset:disabled input, fieldset:disabled button { opacity: .45; cursor: default; }
fieldset:disabled .upload-button { opacity: .45; cursor: default; pointer-events: none; }
.settings-form { margin-top: 22px; padding-bottom: 25px; border-bottom: 1px solid #ffffff2d; }
#dday-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-heading { grid-column: 1 / -1; }
.form-heading h3, .under-stage h3 { margin: 0 0 6px; font-size: 1.5rem; font-weight: 400; }
.form-heading p, .photo-instruction { margin: 0; color: #b8c4c6; font-size: 1rem; line-height: 1.5; }
.field { display: grid; gap: 8px; }
.field label { color: #e6eded; font-size: 1.15rem; }
.field input { font-size: 1.1rem; }
.field input[type=datetime-local] { font-family: system-ui, sans-serif; font-size: 1rem; }
.field input::placeholder { color: #9daeb5; }
.field input:focus, .login-form input:focus { border-color: #f4ba7b; box-shadow: 0 0 0 3px #f4ba7b25; }
.save-button { display: flex; align-items: center; justify-content: center; gap: 20px; min-height: 48px; padding: 10px 18px; border: 0; border-radius: 5px; background: #f4ba7b; color: #19252b; font-size: 1.15rem; white-space: nowrap; }
.save-button:hover { background: #ffce98; }
.save-button:disabled { opacity: .5; cursor: default; }
.form-error { margin: 12px 0 0; color: #ffc4ab; font-size: 1.05rem; }
.under-stage { padding-top: 24px; }
.photo-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.upload-button, .outline-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 14px; border: 1px solid #f4ba7b; border-radius: 5px; background: transparent; color: #f4ba7b; font-size: 1.1rem; white-space: nowrap; }
.upload-button { cursor: pointer; background: #f4ba7b17; }
.upload-button:hover, .outline-button:hover { background: #f4ba7b2b; }
.outline-button { border-color: #859398; color: #e2e8e6; }
.outline-button:disabled { opacity: .45; cursor: default; }
.text-button { padding: 9px 2px; border: 0; background: transparent; color: #e0e8e9; font-size: 1.05rem; }
.text-button:hover { color: #f4ba7b; }
.text-button:disabled { opacity: .4; cursor: default; }
.photo-hint { color: #b4c2c7; font-size: 1rem; }
.photo-thumbnails { display: flex; gap: 8px; overflow-x: auto; padding: 13px 2px 9px; scrollbar-color: #63747a transparent; }
.thumb { flex: 0 0 68px; width: 68px; height: 54px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 3px; background: #283a45; }
.thumb[aria-current="true"] { border-color: #f4ba7b; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-message { min-height: 1.3em; margin: 8px 0 0; color: #f4ba7b; font-size: 1.05rem; }
button:focus-visible, .upload-button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-width: 540px) {
  #dday-editor, .login-form { grid-template-columns: 1fr; }
  .login-form label, .form-heading { grid-column: 1; }
  .settings-open { font-size: 1rem; bottom: max(12px, env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); }
}
@media (prefers-reduced-motion: reduce) { .tile-flip.turn { animation: none; } }
