/* Puzzle terminal — extends styles.css with header/footer, archive, and win flash. */

html, body { height: 100%; }

body {
  background-color: black;
  color: green;
  font-family: monospace;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

#puzzle-frame {
  display: flex;
  flex-direction: column;
  width: 80%;
  max-width: 960px;
  margin: 30px auto;
  border: 2px solid green;
  box-sizing: border-box;
  min-height: calc(100vh - 60px);
}

#puzzle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid green;
  background-color: rgba(0, 80, 0, 0.15);
}

#puzzle-header-left { display: flex; gap: 14px; align-items: baseline; }

#level-label {
  color: lightgreen;
  font-weight: bold;
  letter-spacing: 0.5px;
}

#level-title {
  color: #98FB98;
  font-style: italic;
}

#puzzle-header-right a {
  color: lightgreen;
  text-decoration: none;
  border: 1px solid green;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
}
#puzzle-header-right a:hover {
  background-color: rgba(0, 255, 0, 0.1);
}

/* Override the styles.css defaults for #terminal-container so it fills the frame. */
#terminal-container {
  width: auto;
  margin: 0;
  border: none;
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: auto;
}

#output {
  flex: 1;
  white-space: pre-wrap;
  overflow-y: auto;
  margin-bottom: 10px;
  word-break: break-word;
}

#output .user-line { color: #c8ffc8; }
#output .system-line { color: #88dd88; font-style: italic; }
#output .reply { color: green; }

#input-line {
  display: flex;
  align-items: center;
  border-top: 1px dashed rgba(0,255,0,0.3);
  padding-top: 8px;
}

#input-line #prompt {
  margin-right: 6px;
  color: lightgreen;
}

#terminal-input {
  background-color: black;
  color: green;
  border: none;
  outline: none;
  flex: 1;
  font-family: monospace;
  font-size: 16px;
  caret-color: lightgreen;
}

#puzzle-footer {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 12px;
  border-top: 1px solid green;
  color: #88dd88;
  background-color: rgba(0, 80, 0, 0.10);
}

/* ---- Archive panel ---- */

#archive-panel {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

#archive-panel[hidden] {
  display: none;
}

#archive-panel .archive-inner {
  width: min(560px, 90%);
  background-color: black;
  border: 2px solid green;
  padding: 18px 22px;
  max-height: 80vh;
  overflow-y: auto;
}

#archive-panel .archive-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid green;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

#archive-panel h2 {
  color: lightgreen;
  margin: 0;
}

#archive-close {
  background-color: black;
  color: lightgreen;
  border: 1px solid green;
  padding: 4px 10px;
  font-family: monospace;
  cursor: pointer;
}
#archive-close:hover {
  background-color: rgba(0,255,0,0.1);
}

#archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#archive-list li {
  padding: 8px 4px;
  border-bottom: 1px dashed rgba(0,255,0,0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#archive-list .arch-meta {
  color: #88dd88;
  font-size: 12px;
}

#archive-list a {
  color: lightgreen;
  text-decoration: none;
}
#archive-list a:hover { text-decoration: underline; }

#archive-list .archive-locked {
  color: #5a5a5a;
}

.archive-hint {
  color: #88dd88;
  font-size: 12px;
  margin-top: 14px;
}

/* ---- Win overlay ---- */

#win-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  isolation: isolate;
}

#win-overlay[hidden] {
  display: none;
}

.win-flash {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at center, rgba(180,255,180,0.95) 0%, rgba(0,80,0,0.4) 60%, rgba(0,0,0,0) 100%);
  animation: winflash 1.6s ease-out forwards;
  pointer-events: none;
}

@keyframes winflash {
  0%   { opacity: 0; transform: scale(0.5); }
  20%  { opacity: 1; transform: scale(1.1); }
  60%  { opacity: 0.7; transform: scale(1.0); }
  100% { opacity: 0;  transform: scale(1.0); }
}

.win-modal {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  background-color: black;
  border: 2px solid lightgreen;
  padding: 26px 32px;
  max-width: 90%;
  width: 480px;
  text-align: center;
  box-shadow: 0 0 24px rgba(120, 255, 120, 0.4);
  animation: winrise 0.6s ease-out 0.3s both;
}

@keyframes winrise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.win-title {
  font-size: 22px;
  color: lightgreen;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.win-message {
  color: #b8ffb8;
  margin-bottom: 16px;
  font-style: italic;
}

.win-stats {
  color: #88dd88;
  font-size: 13px;
  margin-bottom: 18px;
}

#win-continue {
  position: relative;
  z-index: 3;
  pointer-events: auto;
  display: inline-block;
  box-sizing: border-box;
  background-color: black;
  color: lightgreen;
  border: 1px solid lightgreen;
  padding: 8px 16px;
  font-family: monospace;
  font-size: 15px;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-decoration: none;
}
#win-continue:hover {
  background-color: rgba(0,255,0,0.12);
}
