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

:root {
  --bg: #000;
  --text: #f5f5f7;
  --muted: #86868b;
  --faint: #424245;
  --accent: #2997ff;
  --gold: #ffd60a;
  --ok: #30d158;
  --warn: #ff9f0a;
  --game-bg: #0a0a0a;
  --game-line: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app { height: 100vh; display: flex; flex-direction: column; }

/* —— Intro (login) —— */

#login {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.intro {
  width: min(480px, 100%);
  text-align: center;
  animation: fadeUp 0.8s ease both;
}

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

.brand {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(2.75rem, 8vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 20px;
}

.lead {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(1.125rem, 3vw, 1.375rem);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 12px;
}

.sub {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 40px;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#google-btn-wrap {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.guest-fields {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.guest-fields.hidden { display: none; }

#name-input {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--faint);
  background: transparent;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 17px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

#name-input::placeholder { color: var(--faint); }
#name-input:focus { border-bottom-color: var(--muted); }

#join-btn {
  width: 100%;
  padding: 14px 28px;
  border: none;
  border-radius: 980px;
  background: var(--text);
  color: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: opacity 0.2s;
}

#join-btn:hover { opacity: 0.88; }
#join-btn:active { opacity: 0.75; }

.foot {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  color: var(--faint);
  margin-top: 32px;
  line-height: 1.5;
}

.foot.fleet {
  margin-top: 48px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hidden { display: none !important; }

/* —— Game (terminal) —— */

#game {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  min-height: 0;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  background: var(--game-bg);
}

#status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 10px 0;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--game-line);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

#st-name { color: var(--text); }
#log .world { color: #bf5af2; font-style: italic; }
#log .world.death { color: #ff453a; }
#log .world.good { color: var(--ok); font-style: normal; }
#log .world.warn { color: var(--warn); }
#log .world.you { color: var(--text); font-style: normal; }
#log .world.thinking { color: #666; font-style: italic; font-size: 0.92em; }

#st-hunger { color: #ff9f0a; }
#st-hunger.hungry { color: #ff6723; }
#st-hunger.starving { color: #ff453a; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
#st-time { color: #86868b; }
#st-deaths { color: #636366; }
#st-activity { color: #64d2ff; margin-left: 8px; }
#st-activity:empty { display: none; }
#st-pack { color: #a8b0bc; margin-left: 8px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#st-pack:empty { display: none; }

#log {
  flex: 1;
  overflow-y: auto;
  line-height: 1.6;
  min-height: 0;
  color: #a1a1a6;
}

#log .line { margin-bottom: 3px; white-space: pre-wrap; word-break: break-word; }
#log .sys { color: #636366; }
#log .you { color: var(--text); }
#log .chat { color: #86868b; }
#log .chat b { color: var(--text); font-weight: 500; }
#log .good { color: var(--ok); }
#log .warn { color: var(--warn); }

#cmd-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--game-line);
}

#cmd-form label { color: var(--muted); }

#cmd-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

#cmd-input::placeholder { color: #48484a; }

@media (max-width: 600px) {
  #login { padding: 32px 20px; }
  .sub { margin-bottom: 32px; }
}
