/* ========================================
   HACK.BAR 4th Anniversary Countdown
   style.css
======================================== */

/* ---------- リセット ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- CSS変数 ---------- */
:root {
  --color-bg:            #080808;
  --color-surface:       rgba(255, 255, 255, 0.03);
  --color-border:        rgba(255, 255, 255, 0.08);

  --color-text:          #e2e2e2;
  --color-text-dim:      #5a5a5a;
  --color-text-muted:    #2e2e2e;

  --color-neon:          #00ffe7;
  --color-neon-glow:     rgba(0, 255, 231, 0.35);
  --color-green:         #3dff6e;
  --color-green-dim:     rgba(61, 255, 110, 0.7);
  --color-amber:         #ffb74d;

  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", monospace;

  --radius-card: 10px;
  --radius-sm:   6px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* ========================================
   背景レイヤー
======================================== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* グリッド */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 44px 44px;
}

/* スキャンライン */
.bg-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.13) 3px,
    rgba(0, 0, 0, 0.13) 4px
  );
}

/* ネオングロー */
.bg-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 35% at 50% -5%, rgba(0, 255, 231, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 50% 25% at 50% 105%, rgba(61, 255, 110, 0.025) 0%, transparent 70%);
}

/* ========================================
   ブートスクリーン
======================================== */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  transition: opacity 0.7s ease;
}

.boot-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-inner {
  max-width: 560px;
  width: 100%;
}

.boot-lines {
  font-family: var(--font-mono);
  font-size: clamp(0.78rem, 2.2vw, 0.92rem);
  line-height: 2.1;
  color: var(--color-green);
}

/* 各行は opacity:0 から visible クラスでフェードイン */
.boot-line {
  display: block;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.boot-line.visible {
  opacity: 1;
}

.boot-cursor {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--color-green);
  animation: blink 0.9s step-end infinite;
  margin-left: 2px;
  vertical-align: text-bottom;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ========================================
   メインコンテンツ
======================================== */
.main-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  padding: clamp(3rem, 8vw, 5rem) clamp(1rem, 4vw, 2rem) 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 5vw, 3.5rem);
  flex: 1;
}

.main-content[hidden] {
  display: none;
}

.main-content.fade-in {
  animation: fadeInUp 0.7s ease both;
}

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

/* ========================================
   ヘッダー / ブランド
======================================== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}

.brand {
  line-height: 1;
}

.brand-logo {
  display: block;
  width: clamp(260px, 70vw, 600px);
  height: auto;
  filter:
    drop-shadow(0 0 10px rgba(0, 255, 231, 0.3))
    drop-shadow(0 0 36px rgba(0, 255, 231, 0.10));
}

.tagline {
  font-size: clamp(0.68rem, 2vw, 0.82rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--color-text-dim);
}

.protocol-label {
  font-size: clamp(0.58rem, 1.6vw, 0.68rem);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--color-neon);
  opacity: 0.55;
  margin-top: 0.2rem;
}

/* ========================================
   カウントダウンセクション
======================================== */
.countdown-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.section-label {
  font-size: clamp(0.62rem, 1.8vw, 0.75rem);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--color-neon);
  opacity: 0.7;
  font-weight: 400;
}

/* ---------- コロン区切り表示 ---------- */
.countdown-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  white-space: nowrap;
  gap: 0;
  width: 100%;
}

.countdown-number {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 10.5vw, 6rem);
  font-weight: 700;
  line-height: 1;
  color: var(--color-text);
  min-width: 2ch;
  text-align: center;
  text-shadow: 0 0 20px rgba(0, 255, 231, 0.15);
  transition: text-shadow 0.35s ease, color 0.35s ease;
}

.countdown-number.pulse {
  color: #fff;
  text-shadow:
    0 0 16px rgba(0, 255, 231, 0.65),
    0 0 40px rgba(0, 255, 231, 0.2);
}

.countdown-colon {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 10.5vw, 6rem);
  font-weight: 300;
  line-height: 1;
  color: var(--color-text-dim);
  padding: 0 clamp(0.04em, 0.5vw, 0.12em); /* 小画面ではパディングを詰める */
  opacity: 0.5;
  user-select: none;
}

/* DAYS / HRS / MIN / SEC の凡例 */
.countdown-legend {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 0.1em;
}

.countdown-legend span {
  flex: 1;
  text-align: center;
  font-size: clamp(0.52rem, 1.4vw, 0.65rem);
  letter-spacing: 0.2em;
  color: var(--color-text-dim);
  text-transform: uppercase;
}

/* ---------- 周年メッセージ ---------- */
.anniversary-message {
  text-align: center;
}

.anniversary-message[hidden] {
  display: none;
}

.anniversary-text {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--color-neon);
  text-shadow:
    0 0 20px var(--color-neon-glow),
    0 0 60px rgba(0, 255, 231, 0.18);
  animation: pulseGlow 2.8s ease-in-out infinite;
}

.anniversary-sub {
  font-size: clamp(0.8rem, 2.2vw, 0.92rem);
  color: var(--color-text-dim);
  margin-top: 0.6rem;
  letter-spacing: 0.18em;
}

@keyframes pulseGlow {
  0%, 100% {
    text-shadow: 0 0 20px var(--color-neon-glow), 0 0 60px rgba(0, 255, 231, 0.18);
  }
  50% {
    text-shadow: 0 0 30px var(--color-neon-glow), 0 0 80px rgba(0, 255, 231, 0.32), 0 0 120px rgba(0, 255, 231, 0.08);
  }
}

/* ========================================
   下部パネル
======================================== */
.lower-panel {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  width: 100%;
  align-items: stretch;
}

/* ---------- ステータスパネル ---------- */
.status-panel {
  flex-shrink: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 0.875rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  justify-content: center;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: clamp(0.58rem, 1.4vw, 0.68rem);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.status-key {
  color: var(--color-text-dim);
  min-width: 5.5em;
}

.status-sep {
  color: var(--color-text-muted);
}

.status-val {
  color: var(--color-text);
}

.status-ok {
  color: var(--color-green-dim);
}

/* ---------- ターミナルログ ---------- */
.terminal-log {
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 0.75rem 1rem;
  height: 9rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.log-lines {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: auto; /* ログを下端に固定 */
}

.log-line {
  font-family: var(--font-mono);
  font-size: clamp(0.58rem, 1.4vw, 0.68rem);
  color: var(--color-text-dim);
  line-height: 1.55;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.log-line::before {
  content: '> ';
  color: var(--color-neon);
  opacity: 0.45;
}

/* 追加直後にフェードイン */
.log-line.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* 古い行は薄く */
.log-line.old {
  opacity: 0.25;
}

/* ========================================
   ENTERボタン
======================================== */
.enter-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
}

.enter-btn {
  display: inline-block;
  padding: 0.8rem 2.5rem;
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.8vw, 0.82rem);
  letter-spacing: 0.28em;
  text-decoration: none;
  color: var(--color-neon);
  border: 1px solid rgba(0, 255, 231, 0.35);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.enter-btn:hover,
.enter-btn:focus-visible {
  border-color: rgba(0, 255, 231, 0.65);
  box-shadow: 0 0 14px rgba(0, 255, 231, 0.15), 0 0 30px rgba(0, 255, 231, 0.06);
  background: rgba(0, 255, 231, 0.04);
}

.enter-btn:focus-visible {
  outline: 2px solid var(--color-neon);
  outline-offset: 4px;
}

.enter-message {
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.8vw, 0.82rem);
  color: var(--color-amber);
  letter-spacing: 0.1em;
  text-align: center;
}

.enter-message[hidden] {
  display: none;
}

/* ========================================
   JS無効時
======================================== */
.noscript-message {
  font-size: 0.9rem;
  color: var(--color-text-dim);
  line-height: 1.8;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  text-align: center;
}

/* ========================================
   フッター
======================================== */
.footer {
  position: relative;
  z-index: 1;
  padding: 1.25rem 1rem;
  text-align: center;
}

.footer p {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--color-text-muted);
}

/* ========================================
   prefers-reduced-motion
======================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .boot-cursor {
    animation: none;
    opacity: 1;
  }
}

/* ========================================
   レスポンシブ
======================================== */
@media (max-width: 640px) {
  .lower-panel {
    flex-direction: column;
  }

  .terminal-log {
    height: 8rem;
  }
}

@media (max-width: 420px) {
  /* 小画面でコロンを少し詰める */
  .countdown-colon {
    padding: 0 0.06em;
  }
}
