*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  --bg:     #ecdfc4;
  --bg2:    #fbf6ea;
  --bg3:    #f2ead9;
  --border: #1b2a4a;
  --text:   #1b2a4a;
  --text2:  #5b5648;
  --text3:  #8a8474;
  --accent: #a8362a;
  --accent2:#d8c08a;
  --green:  #3a6b4a;
  --red:    #a8362a;
  --yellow: #d8c08a;
  --orange: #c97a2e;

  background: linear-gradient(160deg, #f6f0e2 0%, #ecdfc4 65%);
  color: var(--text);
  font-family: 'Shippori Mincho', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ====== SCREENS ====== */

.screen {
  display: none;
  min-height: calc(100vh - 56px);
}

.screen.active {
  display: flex;
  animation: fadeIn .22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen-inner {
  margin: auto;
  width: 100%;
  max-width: 480px;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.3rem;
  text-align: center;
}

/* ====== BUTTONS ====== */

.cta-btn {
  background: var(--border);
  color: #f2ead9;
  border: 1px solid var(--border);
  padding: .75rem 2.2rem;
  border-radius: 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  min-width: 180px;
  align-self: center;
}
.cta-btn:hover  { background: #2c3f66; }
.cta-btn:active { background: #15233d; }
.cta-btn:disabled { opacity: .35; cursor: default; }

.cta-outline {
  display: inline-block;
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
  padding: .6rem 1.75rem;
  border-radius: 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  min-width: 160px;
  text-align: center;
  text-decoration: none;
}
.cta-outline:hover { border-color: var(--accent); color: var(--text); }

/* ====== WELCOME ====== */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  padding-top: .5rem;
}

.hero-icon {
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 4px 16px rgba(168,54,42,.35));
}

.hero-title {
  font-size: 42px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.15;
  color: var(--text);
}
.hero-title span { color: var(--accent); }

.hero-sub {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
  max-width: 260px;
}

.daily-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 1.2rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.daily-card::after {
  content: '';
  position: absolute; top: 0; right: 0;
  border-style: solid;
  border-width: 0 16px 16px 0;
  border-color: transparent var(--accent) transparent transparent;
}

.daily-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: 0;
}

.daily-date { font-size: 12px; color: var(--text3); }

.hint-text { font-size: 13px; color: var(--text2); line-height: 1.55; }

.daily-done { display: flex; flex-direction: column; gap: 3px; }
.daily-done-score { font-size: 19px; font-weight: 700; color: var(--accent2); }
.daily-done-sub   { font-size: 12px; color: var(--green); }

.how-it-works {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  text-align: left;
}

.how-row {
  font-size: 13px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ====== LOADING ====== */

.loader-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loader-icon {
  font-size: 52px;
  animation: breathe 1.8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .45; transform: scale(.92); }
}

.loader-text  { font-size: 14px; color: var(--text2); }

.loader-track {
  width: 180px;
  height: 6px;
  background: var(--bg3);
  border-radius: 999px;
  overflow: hidden;
}

.loader-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0;
  transition: width .5s ease;
}

.loader-count { font-size: 12px; color: var(--text3); }

/* ====== GAME SCREEN ====== */

#screen-game {
  min-height: calc(100vh - 56px);
}

.game-inner {
  max-width: 480px;
  padding: .85rem 1.25rem 1rem;
  gap: .65rem;
  justify-content: flex-start;
}

/* Artwork image */
.artwork-frame {
  width: 100%;
  border-radius: 0;
  overflow: hidden;
  background: var(--bg3);
  border: 1px solid var(--border);
}

.artwork-img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 60vh;
  margin: 0 auto;
  opacity: 0;
  transition: opacity .35s;
}
.artwork-img.loaded { opacity: 1; }

/* Guess section */
.guess-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: center;
}

.guess-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
}

.hint-row {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(168,54,42,.08);
  border: 1px solid var(--accent);
  padding: .35rem .7rem;
  min-height: 1.3em;
  width: 100%;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s;
}
.hint-row.visible { opacity: 1; visibility: visible; }

/* Hint button */
.hint-btn {
  background: transparent;
  border: 1px solid var(--accent2);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: .45rem 1.2rem;
  border-radius: 0;
  cursor: pointer;
  transition: border-color .15s, opacity .15s;
}
.hint-btn:hover     { border-color: var(--accent); }
.hint-btn:disabled  { opacity: .4; cursor: default; }

/* Artist input + dropdown */
.artist-input-wrap {
  position: relative;
  width: 100%;
}

.artist-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: .7rem 1rem;
  outline: none;
  transition: border-color .15s;
}
.artist-input:focus         { border-color: var(--accent); }
.artist-input.input-correct { border-color: var(--green); background: rgba(58,107,74,.12); color: var(--green); }
.artist-input.input-wrong   { border-color: var(--red); animation: shake .35s ease; }
.artist-input.input-reveal  { border-color: var(--green); color: var(--green); }
.artist-input:disabled      { cursor: default; }

.artist-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  z-index: 10;
}
.artist-dropdown:empty { display: none; border: none; }

.artist-suggestion {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: .6rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: background .1s;
}
.artist-suggestion:last-child { border-bottom: none; }
.artist-suggestion:hover      { background: var(--bg3); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  50%       { transform: translateX(5px); }
  75%       { transform: translateX(-3px); }
}

/* Attempt dots */
.attempt-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.attempt-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  transition: background .2s, border-color .2s;
}
.attempt-dot.active { background: var(--accent);  border-color: var(--accent); }
.attempt-dot.used   { background: var(--text3);   border-color: var(--text3); }

/* ====== RESULT SCREEN ====== */

.result-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding-top: .5rem;
}

.result-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1.25rem;
  border: 1.5px solid var(--border);
  background: var(--bg2);
  white-space: nowrap;
}

.result-emoji {
  font-size: 24px;
  line-height: 1;
}

.result-message {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}

.result-hero.outcome-green  .result-banner { border-color: var(--green);  background: #e3efe0; }
.result-hero.outcome-yellow .result-banner { border-color: var(--yellow); background: #f7f0dc; }
.result-hero.outcome-orange .result-banner { border-color: var(--orange); background: #f5e6d3; }
.result-hero.outcome-red    .result-banner { border-color: var(--red);    background: #f5e0dc; }

.result-day {
  font-size: 12px;
  color: var(--text3);
  letter-spacing: .04em;
}

@media (max-width: 380px) {
  .result-banner   { padding: .55rem .85rem; gap: .4rem; }
  .result-emoji    { font-size: 20px; }
  .result-message  { font-size: 15px; }
}

/* Artwork reveal card */
.artwork-reveal {
  max-width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .4s ease, transform .45s cubic-bezier(.34,1.4,.64,1);
}
.artwork-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 50vh;
}

.reveal-info {
  padding: .85rem 1rem .9rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.reveal-artist {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.reveal-title {
  font-size: 13px;
  color: var(--text2);
  font-style: italic;
  font-family: Georgia, serif;
}

.reveal-year {
  font-size: 12px;
  color: var(--text3);
  margin-top: 1px;
}

/* ====== DEV TOOLS ====== */

.dev-bar {
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.dev-btn {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text3);
  font-size: 11px;
  padding: .35rem .9rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, color .15s;
}
.dev-btn:hover { border-color: var(--text3); color: var(--text2); }

.check-results {
  width: 100%;
  font-size: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.check-status { color: var(--text3); }
.check-ok     { color: var(--green); font-weight: 600; }
.check-err    { color: var(--red);   font-weight: 600; margin-bottom: 4px; }
.check-item   { color: var(--text2); padding: 2px 0; border-bottom: 1px solid var(--bg3); }
.check-item b { color: var(--text); }

/* ====== AD SLOT ====== */
.ad-slot {
  width: 100%;
  min-height: 90px;
  background: rgba(27,42,74,.05);
  border: 1px dashed var(--border);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text3);
  letter-spacing: .06em;
  overflow: hidden;
}
.ad-slot:has(> ins) {
  background: none;
  border: none;
  border-radius: 0;
}
.ad-slot:empty {
  display: none;
}

.final-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}

/* ====== ARCHIVE ====== */
.archive-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-bottom: .4rem;
}
.archive-back { min-width: auto; padding: .5rem 1.1rem; }
.archive-title { font-size: 18px; font-weight: 600; color: var(--text); }

.archive-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  max-height: 60vh;
  overflow-y: auto;
}

.archive-day {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: .65rem 1rem;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.archive-day:hover { border-color: var(--accent); }
.archive-day:active { transform: scale(.98); }
.archive-day-num { font-weight: 700; }
.archive-day-date { color: var(--text2); font-size: 12px; }
.archive-day-check { font-size: 14px; }

.archive-empty { font-size: 13px; color: var(--text3); text-align: center; padding: 1rem 0; }
