:root {
  --walnut: #21170f;
  --walnut-2: #33241a;
  --cream: #f4ead8;
  --gold: #c9a24a;
  --teal: #2fa7a0;
  --green: #2f5d3a;
  --pink: #e58fa8;
  --serif: "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--walnut);
  color: var(--cream);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(47, 93, 58, .6), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(47, 167, 160, .16), transparent 50%),
    var(--walnut);
}

.terminal {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6vh;
  padding: max(2vh, env(safe-area-inset-top)) 4vw max(2vh, env(safe-area-inset-bottom));
}

.logo {
  width: clamp(110px, 21vh, 220px);
  height: clamp(110px, 21vh, 220px);
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid rgba(201, 162, 74, .45);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  margin-bottom: .5vh;
}

.clock {
  font-family: var(--serif);
  font-size: clamp(52px, 11vh, 124px);
  line-height: 1;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

.date {
  font-size: clamp(14px, 2.2vh, 22px);
  color: var(--gold);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 1.5vh;
}

.dots { display: flex; gap: 20px; margin-bottom: 1vh; }
.dots span {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  transition: background .12s, transform .12s;
}
.dots span.on { background: var(--gold); transform: scale(1.08); }
.dots.shake { animation: shake .4s; }
.dots.shake span { border-color: var(--pink); }

@keyframes shake {
  20%, 60% { transform: translateX(-12px); }
  40%, 80% { transform: translateX(12px); }
}

.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1.8vh, 20px) clamp(16px, 2.6vh, 28px);
}

.pad button {
  width: clamp(58px, 8.4vh, 96px);
  height: clamp(58px, 8.4vh, 96px);
  border-radius: 50%;
  border: 1px solid rgba(244, 234, 216, .18);
  background: rgba(244, 234, 216, .06);
  color: var(--cream);
  font-family: var(--serif);
  font-size: clamp(26px, 4vh, 40px);
  cursor: pointer;
  transition: background .1s, transform .1s;
}
.pad button:active { background: rgba(201, 162, 74, .35); transform: scale(.94); }
.pad button.soft { background: transparent; border-color: transparent; font-family: var(--sans); font-size: 24px; color: var(--gold); }

.greet {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(47, 93, 58, .75), transparent 65%),
    var(--walnut);
  animation: fade .25s ease-out;
  text-align: center;
  padding: 6vw;
}
.greet.out {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(201, 162, 74, .35), transparent 65%),
    var(--walnut);
}
.greet.warn {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(229, 143, 168, .3), transparent 65%),
    var(--walnut);
}
.greet h1 {
  font-family: var(--serif);
  font-weight: normal;
  font-size: clamp(48px, 9vh, 96px);
  margin: 4vh 0 2vh;
}
.greet p { font-size: clamp(22px, 3.6vh, 36px); margin: 0; opacity: .92; line-height: 1.35; }
@keyframes fade { from { opacity: 0; transform: scale(.98); } }

.badge {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 16px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 600;
  background: var(--teal);
  color: #08211f;
}
.greet.out .badge { background: var(--gold); color: #2a1d08; }
.greet.warn .badge { background: var(--pink); color: #3a0f1c; }

.gate {
  position: fixed; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse at 10% 0%, rgba(31, 111, 229, .16), transparent 55%),
    radial-gradient(ellipse at 95% 100%, rgba(11, 26, 46, .10), transparent 50%),
    #f4f7fc;
  color: #0b1a2e;
  z-index: 20;
  -webkit-user-select: text;
  user-select: text;
}
.home {
  flex: 1;
  width: min(1080px, 92vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 6vw;
  align-items: center;
  padding: 6vh 0 4vh;
}
.hero .gate-logo { width: min(380px, 90%); height: auto; display: block; margin: 0 0 3vh -8px; }
.hero h1 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.15; margin: 0 0 3vh; letter-spacing: -.02em; }
.hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.hero li { position: relative; padding-left: 30px; font-size: 17px; line-height: 1.45; color: #34465f; }
.hero li::before {
  content: "";
  position: absolute; left: 0; top: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #1f6fe5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M5 9.5l2.6 2.5L13 6.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.hero li b { color: #0b1a2e; }
.gate-card {
  display: grid;
  gap: 12px;
  text-align: center;
  padding: 36px 34px 30px;
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(11, 26, 46, .12);
}
.gate-card[hidden] { display: none !important; }
.gate-card h2 { font-family: var(--sans); font-weight: 600; font-size: 22px; margin: 4px 0 0; }
.gate-card p { margin: 0 0 8px; color: #5b6b82; }
.gate input {
  width: 100%;
  padding: 15px 16px;
  font-size: 18px;
  border-radius: 12px;
  border: 1px solid #d3dceb;
  background: #f8fafd;
  color: #0b1a2e;
}
.gate input:focus { outline: 2px solid #1f6fe5; outline-offset: 1px; background: #fff; }
.gate button, .btn-alt {
  padding: 15px;
  font: 600 18px var(--sans);
  border: 0;
  border-radius: 12px;
  background: #1f6fe5;
  color: #fff;
  margin-top: 4px;
  cursor: pointer;
  text-decoration: none;
  display: block;
}
.gate button:active { background: #1659bd; }
.btn-alt { background: #0b1a2e; }
.gate button.link { background: none; color: #5b6b82; font-weight: 500; font-size: 15px; padding: 8px; }
.hint-small { font-size: 13px; margin-top: 4px !important; }
.home-foot { text-align: center; font-size: 13px; color: #7a889c; padding: 0 0 max(18px, env(safe-area-inset-bottom)); }
.home-foot a { color: inherit; }

@media (max-width: 820px) {
  .home { grid-template-columns: 1fr; gap: 4vh; padding-top: 5vh; }
  .hero { text-align: center; }
  .hero .gate-logo { margin: 0 auto 2vh; }
  .hero ul { text-align: left; max-width: 460px; margin: 0 auto; }
}
.gate .err { color: #c0304f !important; }
.err { color: var(--pink) !important; opacity: 1 !important; min-height: 1.4em; }

#keep { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; bottom: 0; left: 0; }

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6vh;
}

body.az {
  background: #f3eee3 url("azulejo.svg") center / 230px 230px repeat;
  color: #1f3352;
}
body.az .panel {
  padding: 3.2vh clamp(28px, 5vw, 64px) 3.6vh;
  border-radius: 34px;
  background: rgba(251, 248, 241, .9);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 2px solid rgba(201, 162, 74, .55);
  box-shadow: 0 24px 70px rgba(31, 51, 82, .28);
}
body.az .logo { box-shadow: 0 10px 28px rgba(31, 51, 82, .2); }
body.az .clock { color: #1f3352; }
body.az .date { color: #a8822f; }
body.az .dots span { border-color: #3a6fb8; }
body.az .dots span.on { background: #3a6fb8; }
body.az .pad button {
  background: #fff;
  border: 1.5px solid #c9d7ec;
  color: #1f3352;
  box-shadow: 0 2px 6px rgba(31, 51, 82, .08);
}
body.az .pad button:active { background: #dbe6f6; }
body.az .pad button.soft { background: transparent; border-color: transparent; box-shadow: none; color: #a8822f; }

body.az .greet {
  background: #f3eee3 url("azulejo.svg") center / 230px 230px repeat;
}
body.az .greet-in {
  padding: 6vh 7vw;
  border-radius: 36px;
  background: rgba(251, 248, 241, .94);
  border: 2px solid rgba(201, 162, 74, .55);
  box-shadow: 0 24px 70px rgba(31, 51, 82, .28);
  color: #1f3352;
}
body.az .greet .badge { background: #3a6fb8; color: #fff; }
body.az .greet.out .badge { background: #c9a24a; color: #2a1d08; }
body.az .greet.warn .badge { background: #d9718f; color: #fff; }
