:root {
  --ink: #12110f;
  --bg: #171512;
  --bg-soft: #211d18;
  --cream: #f3e8ce;
  --muted: #aa9d87;
  --gold: #d2a968;
  --gold-deep: #9a713c;
  --line: rgba(231, 202, 151, .16);
  --glass: rgba(39, 34, 28, .68);
  --danger: #d78b70;
  --radius: 26px;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 18% 38%, rgba(208, 164, 91, .09), transparent 28rem),
    linear-gradient(135deg, #11100e 0%, var(--bg) 50%, #1e1a15 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.15'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: .13;
}

.ambient-one { left: -12rem; top: -9rem; background: #d7a451; }
.ambient-two { right: -14rem; bottom: -12rem; background: #92652c; }

.screen {
  min-height: 100vh;
  width: 100%;
  display: none;
  opacity: 0;
}

.screen.is-active { display: grid; animation: screenIn .75s ease forwards; }
.screen.is-leaving { display: grid; animation: screenOut .55s ease forwards; }

.login-screen {
  position: relative;
  place-items: center;
  padding: clamp(1.5rem, 5vw, 5rem);
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 40%, rgba(255, 214, 110, .3), transparent 70%);
  opacity: 0;
  transition: opacity .6s ease;
}

.login-screen.lamp-on::before { opacity: 1; }

.login-layout {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1fr minmax(320px, 430px);
  align-items: center;
  gap: clamp(2rem, 8vw, 8rem);
}

.lamp-scene {
  position: relative;
  width: 280px;
  height: 400px;
  display: flex;
  justify-content: center;
  justify-self: center;
}

.lamp-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.lamp-shade { fill: #f5f0e6; transition: fill .5s cubic-bezier(.4, 0, .2, 1); }

.lamp-base { fill: #d1ccc2; }

.inner-glow { fill: #ffdb8a; opacity: 0; transition: opacity .5s cubic-bezier(.4, 0, .2, 1); filter: blur(15px); }

.cord-line { stroke: #555; stroke-width: 2; }
.cord-bead { fill: var(--gold); }
.cord-hit { cursor: pointer; }

.login-screen.lamp-on .lamp-shade {
  fill: #fff;
  filter: drop-shadow(0 0 30px rgba(255, 255, 200, .4));
}

.login-screen.lamp-on .inner-glow { opacity: .6; }

.glass-card {
  background: linear-gradient(145deg, rgba(53, 46, 37, .69), var(--glass));
  border: 1px solid var(--line);
  box-shadow: 0 35px 70px rgba(0, 0, 0, .34), inset 0 1px rgba(255,255,255,.035);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.login-card {
  padding: clamp(2rem, 5vw, 3.5rem);
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transform: translateY(30px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.175,.885,.32,1.275);
}

.login-screen.lamp-on .login-card { opacity: 1; pointer-events: auto; transform: translateY(0); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--gold);
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .19em;
  text-transform: uppercase;
}

.eyebrow span { width: 22px; height: 1px; background: var(--gold); }

h1, h2, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { margin: 1.2rem 0; font-size: clamp(2.65rem, 6vw, 4.7rem); line-height: .96; letter-spacing: -.045em; }
h1 em, h2 em { color: var(--gold); font-weight: 400; }
.login-card h1 { font-size: clamp(2.7rem, 5vw, 4rem); }
.intro { color: var(--muted); line-height: 1.7; font-size: .94rem; margin-bottom: 2rem; }

label { display: block; margin: 1rem 0 .48rem; color: #d0c3ab; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.input-wrap { position: relative; }
.input-wrap span { position: absolute; top: 50%; left: 1rem; color: var(--gold); transform: translateY(-50%); }

input {
  width: 100%;
  padding: .95rem 1rem .95rem 2.8rem;
  color: var(--cream);
  background: rgba(12, 11, 9, .32);
  border: 1px solid rgba(230, 206, 162, .12);
  border-radius: 12px;
  outline: 0;
  transition: border-color .25s, box-shadow .25s, background .25s;
}

input::placeholder { color: #756c5d; }
input:focus { border-color: var(--gold); background: rgba(12, 11, 9, .48); box-shadow: 0 0 0 3px rgba(210, 169, 104, .1); }

.primary-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1rem 1.2rem;
  color: var(--ink);
  font-weight: 800;
  background: linear-gradient(110deg, #c99d5d, #ead29c 48%, #bb8849);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .25s, filter .25s, box-shadow .25s;
}

.primary-button:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 12px 30px rgba(203, 156, 89, .18); }
.primary-button:active { transform: translateY(0); }
.primary-button span { font-size: 1.3rem; }
.login-message { min-height: 1.2rem; margin: 1rem 0 0; color: var(--muted); font-size: .78rem; text-align: center; }
.login-message.error { color: var(--danger); animation: shake .35s ease; }
.login-message.success { color: #d5bd84; }
.fine-print { margin: 1.2rem 0 0; color: #746a5b; font-size: .65rem; text-align: center; }

.dashboard-screen {
  align-content: start;
  padding: clamp(2.5rem, 6vh, 5rem) clamp(1.5rem, 4vw, 4rem) clamp(1.5rem, 4vw, 4rem);
}
.dashboard-header, .dashboard-grid, footer { width: min(1180px, 100%); margin-inline: auto; }
.dashboard-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin-bottom: 2rem; }
.dashboard-header h1 { margin: .7rem 0 0; font-size: clamp(2.7rem, 6vw, 5rem); }

.status-pill {
  flex: 0 0 auto;
  margin-bottom: .7rem;
  padding: .65rem .9rem;
  color: #cfc1a8;
  font-size: .72rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: rgba(255,255,255,.025);
}

.status-pill i { display: inline-block; width: 7px; height: 7px; margin-right: .45rem; background: #a9b875; border-radius: 50%; box-shadow: 0 0 10px #a9b875; }
.dashboard-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 1.2rem; }
.control-menu, .content-panel { border-radius: var(--radius); }
.control-menu { padding: 1rem; }
.menu-label { margin: .4rem .6rem .8rem; color: #756b5b; font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; }

.control-button {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: .8rem;
  padding: .9rem;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 15px;
  cursor: pointer;
  transition: background .22s, border-color .22s, transform .22s;
}

.control-button:hover { background: rgba(255,255,255,.035); transform: translateX(3px); }
.control-button.is-selected { background: rgba(211, 169, 104, .1); border-color: rgba(211, 169, 104, .18); }
.control-button b { display: grid; place-items: center; width: 42px; height: 42px; font-size: 1.2rem; font-weight: 400; background: rgba(10,9,8,.26); border: 1px solid rgba(255,255,255,.05); border-radius: 12px; }
.control-button span { font-size: .87rem; font-weight: 650; }
.control-button small { display: block; margin-top: .2rem; color: #7e7362; font-size: .66rem; font-weight: 400; }
.control-button i { color: #6f6555; font-style: normal; }
.exit-button { margin-top: .25rem; border-top-color: rgba(255,255,255,.05); border-radius: 0 0 15px 15px; }

.content-panel { position: relative; min-height: 440px; padding: clamp(2rem, 5vw, 4.5rem); overflow: hidden; }
.content-panel::before { content: ""; position: absolute; width: 270px; height: 270px; right: -120px; bottom: -140px; border: 1px solid rgba(211,169,104,.11); border-radius: 50%; box-shadow: 0 0 0 45px rgba(211,169,104,.025), 0 0 0 90px rgba(211,169,104,.018); }
.panel-number { position: absolute; top: 1.4rem; right: 1.6rem; color: #746a5b; font-family: Georgia, serif; font-size: .75rem; letter-spacing: .15em; }
.panel-content { position: relative; z-index: 1; max-width: 650px; animation: panelIn .4s ease; }
.panel-icon { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 1.7rem; font-size: 1.8rem; border: 1px solid var(--line); border-radius: 18px; background: rgba(212, 169, 102, .08); }
.panel-content h2 { margin-bottom: .8rem; font-size: clamp(2.1rem, 4.5vw, 3.7rem); line-height: 1.04; letter-spacing: -.035em; }
.panel-content > p { color: var(--muted); line-height: 1.65; }
.reward-list { margin: 1.6rem 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.reward-list li { display: flex; justify-content: space-between; padding: .7rem .15rem; color: #d7c9af; border-bottom: 1px solid var(--line); }
.reward-list strong { color: var(--gold); }

.secondary-button {
  padding: .85rem 1.1rem;
  color: var(--cream);
  font-weight: 700;
  background: rgba(211, 169, 104, .12);
  border: 1px solid rgba(211, 169, 104, .29);
  border-radius: 11px;
  cursor: pointer;
  transition: .22s ease;
}

.secondary-button:hover { transform: translateY(-2px); background: rgba(211, 169, 104, .2); }
.result-box { min-height: 72px; display: flex; align-items: center; margin: 1.4rem 0; padding: 1.1rem 1.2rem; color: #e1cfaa; font-family: Georgia, serif; font-size: 1.15rem; line-height: 1.45; border-left: 2px solid var(--gold); background: rgba(10, 9, 8, .22); border-radius: 0 12px 12px 0; }
.wisdom-result { min-height: calc(2.9em + 2.2rem); }
.mission-list { display: grid; gap: .12rem; margin-top: 1rem; }
.mission-item { display: flex; align-items: center; gap: .7rem; padding: .5rem .9rem; color: #cbbda4; background: rgba(10,9,8,.18); border: 1px solid rgba(255,255,255,.05); border-radius: 10px; cursor: pointer; }
.mission-item input { width: 17px; height: 17px; padding: 0; accent-color: var(--gold); }
.mission-item.impossible { cursor: not-allowed; }
.mission-item:has(input:checked) span { color: #736958; text-decoration: line-through; }

.picture-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-top: 1.4rem; }
.picture-card { padding: .55rem .55rem .8rem; color: #3a2d20; background: #e8dcc1; border: 0; border-radius: 5px; box-shadow: 0 12px 24px rgba(0,0,0,.22); transform: rotate(-2deg); }
.picture-card[data-picture] { cursor: zoom-in; transition: transform .25s ease, box-shadow .25s ease; }
.picture-card[data-picture]:hover { transform: rotate(0) translateY(-5px); box-shadow: 0 18px 32px rgba(0,0,0,.32); }
.picture-card:nth-child(2) { transform: translateY(8px) rotate(2deg); }
.picture-card:nth-child(3) { transform: rotate(-1deg); }
.picture-art { display: grid; place-items: center; min-height: 105px; font-size: 2.5rem; background: linear-gradient(145deg, #9a713c, #34291f); border-radius: 2px; }
.picture-art img { display: block; width: 100%; height: 105px; object-fit: cover; }
.picture-card[data-picture="pic1.png"] .picture-art img { object-position: center 25%; }
.picture-card[data-picture="pic2.png"] .picture-art img { object-position: center 40%; }
.picture-card[data-picture="pic3.png"] .picture-art img { object-position: center 25%; }
.picture-card strong { display: block; margin-top: .65rem; font-family: Georgia, serif; font-size: .83rem; text-align: center; }

footer { display: flex; justify-content: space-between; margin-top: 1.5rem; color: #645b4d; font-size: .62rem; letter-spacing: .09em; text-transform: uppercase; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 2rem; max-width: min(90vw, 520px); padding: .9rem 1.2rem; color: var(--ink); font-weight: 750; text-align: center; background: #e2c58d; border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: .3s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.cake-modal { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 1.5rem; background: rgba(8,7,6,.76); backdrop-filter: blur(10px); }
.cake-modal[hidden] { display: none; }
.cake-card { position: relative; width: min(460px, 100%); padding: 2.5rem; text-align: center; border-radius: var(--radius); animation: cakeIn .45s cubic-bezier(.2,.9,.25,1.25); }
.cake-card .eyebrow { justify-content: center; }
.cake-card h2 { margin: 1rem 0 .8rem; font-size: 2.4rem; }
.cake-card p { color: var(--muted); line-height: 1.6; }
.modal-close { position: absolute; top: .8rem; right: .8rem; width: 34px; height: 34px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.cake { width: 150px; height: 145px; display: grid; align-content: end; justify-items: center; margin: 0 auto 1.5rem; }
.flame { color: #f1b553; font-size: 1.15rem; filter: drop-shadow(0 0 7px #efa43b); animation: flame .8s infinite alternate; }
.candle { width: 8px; height: 35px; background: repeating-linear-gradient(45deg, #ece0be 0 5px, #b88a50 5px 10px); }
.icing { z-index: 2; width: 130px; height: 25px; margin-bottom: -12px; background: #e6cf9e; border-radius: 50%; }
.cake-body { display: grid; place-items: center; width: 130px; height: 65px; color: #e3bd74; background: #90653a; border-radius: 3px 3px 15px 15px; }

.picture-modal { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 1.5rem; background: rgba(8,7,6,.82); backdrop-filter: blur(10px); }
.picture-modal[hidden] { display: none; }
.picture-modal-card { position: relative; width: min(850px, 94vw); max-height: 90vh; padding: 1rem; border-radius: var(--radius); animation: cakeIn .4s cubic-bezier(.2,.9,.25,1.1); }
.picture-modal-card img { display: block; width: 100%; max-height: calc(90vh - 6rem); object-fit: contain; border-radius: 16px; }
.picture-modal-card h2 { margin: .8rem 0 .1rem; font-size: 1.5rem; text-align: center; }
.picture-modal-card .modal-close { z-index: 2; color: var(--cream); background: rgba(12,10,8,.72); }

.confetti-layer { position: fixed; z-index: 40; inset: 0; overflow: hidden; pointer-events: none; }
.confetti { position: absolute; top: -20px; width: 8px; height: 15px; animation: confettiFall var(--duration) ease-in forwards; transform: rotate(var(--rotation)); }

@keyframes screenIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes screenOut { to { opacity: 0; transform: scale(.985); } }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes cakeIn { from { opacity: 0; transform: scale(.7) rotate(-4deg); } to { opacity: 1; transform: none; } }
@keyframes flame { to { transform: scale(.85) rotate(5deg); } }
@keyframes confettiFall { to { top: 110vh; transform: translateX(var(--drift)) rotate(calc(var(--rotation) + 720deg)); } }

@media (max-width: 820px) {
  .dashboard-screen { align-content: start; }
  .login-screen::before { background: radial-gradient(circle at 50% 30%, rgba(255, 214, 110, .3), transparent 65%); }
  .login-layout { grid-template-columns: 1fr; gap: 0; }
  .lamp-scene { width: 220px; height: 300px; margin-bottom: -1rem; }
  .login-card { position: relative; z-index: 3; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .control-menu { display: grid; grid-template-columns: repeat(6, 1fr); padding: .6rem; overflow-x: auto; }
  .menu-label, .control-button small, .control-button i { display: none; }
  .control-button { display: flex; flex-direction: column; gap: .35rem; min-width: 82px; padding: .6rem .3rem; text-align: center; }
  .control-button b { width: 38px; height: 38px; }
  .control-button span { font-size: .68rem; }
  .exit-button { margin: 0; border: 1px solid transparent; border-radius: 15px; }
  .content-panel { min-height: 420px; }
  .picture-grid { grid-template-columns: repeat(3, minmax(100px, 1fr)); overflow-x: auto; padding-bottom: .7rem; }
}

@media (max-width: 540px) {
  .login-screen, .dashboard-screen { padding: 1rem; }
  .lamp-scene { min-height: 230px; }
  .lamp { width: 190px; }
  .dashboard-header { align-items: flex-start; margin: 0 0 1.25rem; }
  .status-pill { display: none; }
  .dashboard-header h1 { font-size: 2.8rem; }
  .content-panel { min-height: 430px; padding: 2.8rem 1.4rem 1.5rem; }
  .panel-number { top: 1rem; right: 1.2rem; }
  footer span:first-child, footer span:last-child { display: none; }
  footer { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
