/* Kaffee Tracker — clean ASCII/terminal aesthetic, grayscale */
:root {
  --bg: #0c0d0e;
  --fg: #e4e2dd;
  --muted: #7c7b76;
  --line: #26282c;
  --line-soft: #1b1d20;
  --panel: #111315;
  --panel-2: #15181b;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); }
a:hover { color: var(--fg); border-bottom-color: var(--muted); }

/* ---------- nav ---------- */
.topnav {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 26px clamp(20px, 6vw, 64px) 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}
.brand { font-size: 15px; letter-spacing: .14em; font-weight: 500; text-transform: uppercase; }
.links { display: flex; gap: 18px; flex-wrap: wrap; }
.links a {
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); border-bottom: none;
}
.links a.on { color: var(--fg); }
.links a:hover { color: var(--fg); }

/* ---------- main ---------- */
main {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(40px, 9vh, 84px) clamp(20px, 6vw, 64px) 100px;
}
h1 {
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 500;
  letter-spacing: .02em;
  font-family: var(--mono);
  text-transform: lowercase;
  margin-bottom: 6px;
}
h2 {
  font-size: 14px; font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  font-family: var(--mono);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
section { margin-top: 52px; }
.muted { color: var(--muted); font-size: 15px; }

/* ---------- cards / forms ---------- */
.card {
  margin-top: 34px;
  padding: clamp(22px, 4vw, 36px);
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 20px;
}
label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; }
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 11px 13px;
  font-size: 16px;
  font-family: var(--serif);
  border-radius: 0;
  -webkit-appearance: none; appearance: none;
}
select { cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--muted); }
textarea { resize: vertical; line-height: 1.5; }
::placeholder { color: var(--line-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

button {
  font-family: var(--mono);
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  background: var(--fg); color: var(--bg);
  border: 1px solid var(--fg);
  padding: 12px 22px; cursor: pointer; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
button:hover { background: transparent; color: var(--fg); }
button:disabled { opacity: .35; cursor: not-allowed; background: var(--fg); color: var(--bg); }
button.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
button.ghost:hover { color: var(--fg); border-color: var(--muted); }
.btnrow { display: flex; gap: 12px; flex-wrap: wrap; }
button.next, button.done, button.back { align-self: flex-start; }

/* ---------- auth ---------- */
.links .auth { display: flex; align-items: center; gap: 10px; }
.links .auth .who { color: var(--fg); font-size: 13px; text-transform: none; letter-spacing: 0; }
.links .auth .authform { display: inline; }
.links .auth button.ghost { padding: 6px 12px; font-size: 11px; }
.links .authlink { border-bottom: none; }
.login-card { max-width: 420px; }
.stub-note { font-size: 12px; line-height: 1.5; }

/* ---------- voice input ---------- */
.voice-bar { margin-top: 26px; }
#mic-toggle { margin-bottom: 0; }
.mic-status { font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); min-height: 20px; }
.mic-hint { font-size: 13px; max-width: 380px; margin: 0 auto; }
.mic-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 18px; border-radius: 50%;
  transition: color .15s ease, transform .15s ease;
}
.mic-btn:hover { color: var(--fg); background: none; }
.mic-btn.on { color: var(--fg); animation: micPulse 1.6s ease-in-out infinite; }
.mic-btn.on #mic-record-glyph { animation: micRec .9s ease-in-out infinite; }
@keyframes micPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes micRec { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(1.28); } }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-family: var(--mono); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--panel-2); }
a.sm { font-size: 13px; font-family: var(--mono); border-bottom: none; }

/* ---------- dialog (full-screen) ---------- */
dialog {
  border: none; padding: 0; margin: auto;
  width: 100%; height: 100%;
  max-width: 100vw; max-height: 100vh;
  background: var(--bg); color: var(--fg);
  overflow: auto;
}
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(2px); }
.dialog-inner {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; text-align: center;
  padding: 48px clamp(20px, 6vw, 64px);
  position: relative;
}
.dialog-inner h2 { margin-bottom: 0; }
.close-x {
  position: absolute; top: 18px; right: 22px;
  background: none; border: none; color: var(--muted);
  font-size: 26px; line-height: 1; padding: 6px;
}
.close-x:hover { color: var(--fg); }
.qr-box { background: #fff; padding: 14px; box-shadow: 0 0 0 1px var(--line); }
.qr-box img { display: block; width: min(240px, 66vw); height: auto; }
.share-link { font-family: var(--mono); font-size: 13px; word-break: break-all; color: var(--muted); }
.share-link a { border-bottom-color: var(--muted); }
.share-link a:hover { color: var(--fg); }

/* ---------- rating flow ---------- */
.rating-wrap { max-width: 520px; margin: 0 auto; text-align: center; }
.drink-info { margin-bottom: 40px; }
.drink-info h1 { font-size: clamp(30px, 6vw, 44px); }
.step-ind { display: flex; gap: 8px; justify-content: center; margin-bottom: 40px; }
.step-ind-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background .2s ease; }
.step-ind-dot.active { background: var(--fg); }
.step { display: none; }
.step.active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* morphing face */
.facebox { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 6px; }
#face { color: var(--fg); }
#face.pop { animation: facePop .3s ease; }
@keyframes facePop { 0% { transform: scale(1); } 40% { transform: scale(1.07); } 100% { transform: scale(1); } }
.face-label { font-family: var(--mono); font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }

/* slider */
.slider-wrap { margin: 16px 0 4px; }
input[type="range"]#rating-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px;
  background: linear-gradient(to right, var(--line), var(--fg) var(--fill,50%), var(--line) var(--fill,50%));
  outline: none; cursor: pointer; border: none; padding: 0;
}
input[type="range"]#rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--fg); border: none; cursor: pointer;
}
input[type="range"]#rating-slider::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--fg); border: none; cursor: pointer;
}
.slider-scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-top: 12px; }

.flags { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.flag {
  flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); padding: 15px 16px;
  color: var(--fg); font-size: 16px; cursor: pointer; font-family: var(--serif);
  text-transform: none; letter-spacing: 0;
}
.flag input { width: 18px; height: 18px; accent-color: var(--fg); border: 1px solid var(--line); }
.flag:hover { border-color: var(--muted); }
.flag:has(input:checked) { border-color: var(--fg); }

.saved-hint { min-height: 22px; font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 10px; }
.saved-hint.ok { color: var(--fg); }
.done-msg { margin-top: 24px; padding: 36px 28px; background: var(--panel); border: 1px solid var(--line); }
.done-msg h2 { margin-bottom: 8px; }

/* animierter Kaffee (Danke-Screen) */
.cup-scene { margin-bottom: 18px; }
.cup { color: var(--fg); animation: cupSway 3.2s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes cupSway { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-2.5deg) translateY(-3px); } }
.cup .steam { opacity: 0; animation: steamRise 2.6s ease-in-out infinite; }
.cup .steam.s1 { animation-delay: 0s; }
.cup .steam.s2 { animation-delay: .7s; }
.cup .steam.s3 { animation-delay: 1.4s; }
@keyframes steamRise {
  0% { opacity: 0; transform: translateY(4px); }
  30% { opacity: .7; }
  60% { opacity: .35; }
  100% { opacity: 0; transform: translateY(-22px); }
}
.enjoy { font-family: var(--mono); font-size: 17px; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 8px; color: var(--fg); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .flags { grid-template-columns: 1fr; }
  .topnav { flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px 20px 16px; }
  .links { gap: 14px; }
}
