@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-office: #151a24;
  --bg-panel: #0e1119;
  --paper: #e8dfc8;
  --paper-dim: #c8bd9f;
  --brass: #c9973f;
  --brass-dim: #8f6c2c;
  --alert: #a13d3d;
  --ink: #1c1f26;
  --muted: #5b6472;
  --radius: 3px;
  --shadow-deep: 0 12px 32px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, rgba(201,151,63,0.06), transparent 60%),
    var(--bg-office);
  color: var(--paper);
  font-family: 'Courier Prime', 'Courier New', monospace;
  line-height: 1.5;
}

.scene {
  min-height: 100vh;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scene-center { justify-content: center; }

.topbar {
  width: 100%;
  max-width: 720px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px 20px;
  font-size: 0.9rem;
  color: var(--paper-dim);
}

.link-discret {
  color: var(--brass);
  text-decoration: none;
  border-bottom: 1px dotted var(--brass-dim);
}
.link-discret:hover { color: var(--paper); }
/* Bouton de déconnexion (formulaire POST) présenté comme un lien discret */
.logout-form { display: inline; margin: 0; }
button.link-discret {
  background: none;
  border: 0;
  border-bottom: 1px dotted var(--brass-dim);
  padding: 0;
  font: inherit;
  cursor: pointer;
}

/* --- Le dossier / carte principale --- */
.case-file {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: var(--bg-panel);
  border: 1px solid #2a3040;
  border-radius: var(--radius);
  box-shadow: var(--shadow-deep);
  padding: 32px 28px 28px;
}

.case-file::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed #3a4256;
  border-radius: var(--radius);
  pointer-events: none;
}

.case-center { text-align: center; }

.login-file { max-width: 460px; text-align: center; }

.badge-corner {
  position: absolute;
  top: -18px;
  left: 24px;
  width: 44px;
  height: 44px;
  background: var(--brass);
  color: var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.typewriter-title {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--paper);
  margin: 12px 0 4px;
  font-size: 1.6rem;
}
.typewriter-title.small { font-size: 1.15rem; margin-top: 20px; }

.subtitle {
  color: var(--brass);
  margin: 0 0 24px;
  font-size: 0.95rem;
}

.note-manuscrite {
  color: var(--paper-dim);
  font-style: italic;
  font-size: 0.9rem;
}

.score-final {
  font-size: 1.4rem;
  color: var(--brass);
  font-weight: 700;
}

.alert-box {
  background: rgba(161,61,61,0.15);
  border: 1px solid var(--alert);
  color: #f0c9c9;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* --- Formulaires --- */
.login-form, .answer-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  margin-top: 16px;
}

label {
  color: var(--brass);
  font-size: 0.85rem;
  margin-top: 10px;
}

input[type="text"], input[type="email"] {
  background: var(--bg-office);
  border: 1px solid #3a4256;
  color: var(--paper);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
}
input[type="text"]:focus, input[type="email"]:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.stamp-button {
  margin-top: 20px;
  align-self: flex-start;
  background: var(--brass);
  color: var(--ink);
  border: none;
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px 28px;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--brass-dim);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.stamp-button:hover { filter: brightness(1.08); }
.stamp-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--brass-dim);
}
.stamp-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* --- Dossier d'exercice --- */
.case-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px dashed #3a4256;
  padding-bottom: 14px;
  margin-bottom: 6px;
}

.badge-number {
  font-weight: 700;
  color: var(--paper);
  background: var(--bg-office);
  border: 1px solid var(--brass-dim);
  padding: 4px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.timer-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 160px; }
.timer-label { font-size: 0.75rem; color: var(--muted); }
.timer-gauge {
  width: 160px;
  height: 8px;
  background: var(--bg-office);
  border: 1px solid #3a4256;
  border-radius: 4px;
  overflow: hidden;
}
.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--brass);
  transition: width 1s linear, background-color 0.6s ease;
}
.timer-score { font-weight: 700; color: var(--brass); font-size: 0.95rem; }

.instructions { color: var(--paper-dim); font-size: 0.92rem; }

.code-exhibit {
  background: var(--bg-office);
  border: 1px solid #3a4256;
  border-left: 4px solid var(--brass);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  color: #d7e0ea;
  white-space: pre;
  margin: 12px 0 18px;
}

.result-box {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--radius);
  font-size: 1rem;
}
.result-box.correct { background: rgba(80,140,90,0.15); border: 1px solid #4c8a5a; color: #cdeed4; }
.result-box.incorrect { background: rgba(161,61,61,0.15); border: 1px solid var(--alert); color: #f0c9c9; }
.result-box.a_verifier { background: rgba(201,151,63,0.15); border: 1px solid var(--brass); color: #f2e2bd; }

/* --- Page d'accueil (adresse ouverte sans lien de session) --- */
.landing { width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: 32px; padding-top: 24px; }
.landing .case-file { max-width: none; }
.landing-title { font-size: 2rem; }
.landing-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.landing-roles-single { grid-template-columns: 1fr; max-width: 620px; width: 100%; margin: 0 auto; }
.landing-role h2 { margin-top: 0; }
.landing-notice {
  display: inline-block;
  margin: 4px 0 0;
  padding: 4px 12px;
  border: 1px solid var(--brass);
  border-radius: var(--radius);
  color: var(--brass);
}
.landing-small { font-size: 0.85rem; color: var(--paper-dim); }
a.stamp-button { display: inline-block; text-decoration: none; }
.landing-button { margin-top: 4px; }
.landing-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; font-size: 0.85rem; }

@media (max-width: 480px) {
  .case-file { padding: 24px 18px 20px; }
  .timer-wrap { align-items: flex-start; width: 100%; }
  .timer-gauge { width: 100%; }
  .landing-title { font-size: 1.6rem; }
}
