:root {
  --parchment: #f4ecd8;
  --ink: #3a2e1f;
  --wood: #8a5a36;
  --wood-dark: #6b4226;
  --sky: #aee4f4;
  --interior: #e8c9a0;
  --good: #4c7a3d;
  --bad: #a23b3b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--parchment);
  color: var(--ink);
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--wood-dark);
  color: var(--parchment);
}
header h1 { margin: 0; font-size: 1.4rem; letter-spacing: 0.05em; }
#progress { flex: 1; font-size: 0.9rem; opacity: 0.9; }
#journalBtn {
  background: var(--wood);
  color: var(--parchment);
  border: 1px solid var(--parchment);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
}

main {
  max-width: 640px;
  margin: 32px auto;
  padding: 24px;
  background: #fffdf6;
  border: 2px solid var(--wood);
  border-radius: 10px;
  position: relative;
  min-height: 320px;
}

.tier-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wood);
  margin-bottom: 8px;
}

.scenario-title {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--wood-dark);
}

.caption { margin: 14px 0; }
.caption.npc { background: #fbeed9; border-left: 4px solid var(--wood); padding: 8px 12px; border-radius: 4px; }
.caption .ga { font-size: 1.25rem; font-weight: bold; margin: 4px 0; }
.caption .en { font-size: 0.95rem; color: #6b5d4a; margin: 2px 0; font-style: italic; }

.word-spotlight {
  background: #fff3d6;
  border: 1px dashed var(--wood);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 12px 0;
  font-size: 0.95rem;
}

.btn-row { display: flex; gap: 10px; margin-top: 16px; }

button {
  font-family: inherit;
  cursor: pointer;
}

.btn-continue, #replayBtn {
  background: var(--wood);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 1rem;
}
.btn-continue:hover, #replayBtn:hover { background: var(--wood-dark); }

.bank-label { font-size: 0.8rem; color: var(--wood); margin-top: 14px; text-transform: uppercase; letter-spacing: 0.05em; }

.word-bank { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }

.verb-btn, .word-btn {
  background: var(--parchment);
  border: 2px solid var(--wood);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 1.05rem;
  color: var(--ink);
}
.verb-btn:hover, .word-btn:hover { background: #fff3d6; }
.verb-btn.selected { background: var(--wood); color: white; }
.verb-btn.reveal, .word-btn.reveal { background: #fff3a0; border-color: gold; animation: glow 1s infinite alternate; }
@keyframes glow { from { box-shadow: 0 0 2px gold; } to { box-shadow: 0 0 12px gold; } }

.sentence-bar {
  margin-top: 14px;
  padding: 8px 12px;
  background: #efe6d0;
  border-radius: 6px;
  font-size: 1.1rem;
  min-height: 1.4em;
}

.hint-box { min-height: 1.2em; margin: 6px 0; }
.hint-box p.hint { color: var(--bad); margin: 2px 0; }
.hint-box.success { color: var(--good); }
.hint-box.success .ga { font-size: 1.1rem; font-weight: bold; margin: 2px 0; }
.hint-box.success .en { font-style: italic; color: #4c7a3d; margin: 2px 0; }

.flash {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  background: var(--bad);
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
}
.flash.good { background: var(--good); }

.stage-cottage {
  position: relative;
  height: 160px;
  display: flex;
  border: 1px solid var(--wood);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}
.zone-outside, .zone-inside {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 0.75rem;
  color: rgba(0,0,0,0.45);
  padding-bottom: 4px;
}
.zone-outside { background: linear-gradient(to bottom, var(--sky), #d8f1fb); }
.zone-inside { background: linear-gradient(to bottom, var(--interior), #f5ddb8); }
.wall {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 18px;
  margin-left: -9px;
  background: var(--wood-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  z-index: 1;
}
.door, .window { font-size: 1.1rem; }
.character {
  position: absolute;
  bottom: 10px;
  font-size: 2rem;
  transform: translateX(-50%);
  transition: left 1.1s ease-in-out;
}

.stage-tower {
  position: relative;
  height: 200px;
  width: 150px;
  margin: 0 auto 8px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--wood);
  border-radius: 8px;
  overflow: hidden;
}
.zone-top, .zone-bottom {
  flex: 1;
  font-size: 0.75rem;
  color: rgba(0,0,0,0.45);
  padding: 4px 8px;
}
.zone-top { background: linear-gradient(to bottom, var(--sky), #d8f1fb); }
.zone-bottom { background: linear-gradient(to bottom, #cdb27a, var(--interior)); }
.shaft {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 14px;
  margin-left: -7px;
  background: var(--wood-dark);
  z-index: 1;
}
.character.character-tower {
  bottom: auto;
  left: 50%;
  transition: top 1.1s ease-in-out;
}

#journal {
  position: fixed;
  top: 0; right: 0;
  width: 320px;
  height: 100%;
  background: var(--parchment);
  border-left: 3px solid var(--wood);
  padding: 20px;
  overflow-y: auto;
  box-shadow: -4px 0 12px rgba(0,0,0,0.2);
}
#journal.hidden { display: none; }
#journal h2 { margin-top: 0; }
.journal-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #ddd2b8; }
.ji { font-weight: bold; }
.je { color: #6b5d4a; font-size: 0.85rem; }
.je-star { color: var(--good); font-size: 0.8rem; }
#journal button { margin-top: 16px; background: var(--wood); color: white; border: none; border-radius: 6px; padding: 8px 14px; }

footer {
  text-align: center;
  padding: 16px;
  opacity: 0.7;
}
.dev-label { font-size: 0.75rem; margin-bottom: 6px; }
#dev-tools { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
#dev-tools button {
  font-size: 0.75rem;
  background: none;
  border: 1px solid var(--wood);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--wood-dark);
}
