/* =========================
   CYBERPUNK HUD CORE
========================= */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

:root {
  --bg: #03080f;
  --panel-bg: rgba(0, 18, 35, 0.92);
  --cyan: #00f0ff;
  --cyan-dim: rgba(0, 240, 255, 0.08);
  --cyan-border: rgba(0, 240, 255, 0.5);
  --cyan-glow: 0 0 8px rgba(0, 240, 255, 0.8), 0 0 20px rgba(0, 240, 255, 0.3);
  --text: #c8f8ff;
  --muted: #3a6677;
  --red: #ff2a2a;
  --accent: #00ffcc;
  --font-hud: 'Orbitron', monospace;
  --font-mono: 'Share Tech Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === GRID BACKGROUND === */
.geo-bg {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(rgba(0,240,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* scanline overlay */
.geo-bg::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.15) 2px,
    rgba(0,0,0,0.15) 4px
  );
  pointer-events: none;
}

/* === LAYOUT === */
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* === HEADER === */
header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cyan-border);
  position: relative;
}

.brand {
  font-family: var(--font-hud);
  font-size: 22px; font-weight: 900;
  color: var(--cyan);
  text-shadow: var(--cyan-glow);
  letter-spacing: 0.2em;
  position: relative;
}

.brand::before {
  content: "SYS_";
  font-size: 10px;
  color: var(--muted);
  position: absolute;
  top: -12px; left: 0;
  letter-spacing: 0.1em;
}

.header-status {
  display: flex; align-items: center; gap: 12px;
  font-size: 10px; color: var(--muted);
}

.status-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.help-mini-btn {
  flex: none;
  width: 26px; height: 26px; min-width: 26px;
  background: none;
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
  font-family: var(--font-hud);
  font-size: 11px; cursor: pointer;
  opacity: 0.6;
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
  transition: all 0.2s;
}
.help-mini-btn:hover { opacity: 1; background: var(--cyan-dim); box-shadow: var(--cyan-glow); }

/* ================================
   HUD PANEL — 斜め切り角コーナー
================================ */
.hud-panel {
  background: var(--panel-bg);
  border: 1px solid var(--cyan-border);
  margin-bottom: 18px;
  position: relative;
  clip-path: polygon(
    0 0,
    calc(100% - 18px) 0,
    100% 18px,
    100% 100%,
    18px 100%,
    0 calc(100% - 18px)
  );
}

/* 角のアクセントライン */
.hud-panel::before {
  content: "";
  position: absolute; inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(to right, var(--cyan) 2px, transparent 2px) top left / 16px 16px no-repeat,
    linear-gradient(to bottom, var(--cyan) 2px, transparent 2px) top left / 16px 16px no-repeat,
    linear-gradient(to left, var(--cyan) 2px, transparent 2px) bottom right / 16px 16px no-repeat,
    linear-gradient(to top, var(--cyan) 2px, transparent 2px) bottom right / 16px 16px no-repeat;
  box-shadow: inset 0 0 30px rgba(0, 240, 255, 0.04);
}

/* 右上コーナーの斜めライン装飾 */
.hud-panel::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 20px 20px 0;
  border-color: transparent var(--cyan) transparent transparent;
  opacity: 0.5;
}

.panel-header {
  background: linear-gradient(90deg, rgba(0,240,255,0.12), transparent);
  padding: 8px 16px;
  font-family: var(--font-hud);
  font-size: 10px;
  color: var(--cyan);
  border-bottom: 1px solid var(--cyan-border);
  display: flex; align-items: center; justify-content: space-between;
  letter-spacing: 0.15em;
}

.panel-header .ph-id {
  font-size: 9px; color: var(--muted);
  font-family: var(--font-mono);
}

/* =====================
   HORIZONTAL CONNECTOR
   (パネル間の回路線)
===================== */
.connector-h {
  height: 24px;
  position: relative;
  margin: -10px 0;
  z-index: 1;
}
.connector-h::before {
  content: "";
  position: absolute;
  left: 60px; top: 50%;
  width: calc(100% - 120px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan-border), transparent);
}
.connector-h::after {
  content: "◆";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  color: var(--cyan-border);
  font-size: 8px;
}

/* === INPUT AREA === */
.input-area { padding: 16px 20px; }

textarea {
  width: 100%; height: 72px;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--cyan-border);
  border-left: 3px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 10px 14px;
  outline: none;
  resize: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}
textarea:focus {
  border-color: var(--cyan);
  box-shadow: var(--cyan-glow), inset 0 0 20px rgba(0,240,255,0.04);
}
textarea::placeholder { color: var(--muted); font-size: 12px; }

.btn-row { display: flex; gap: 10px; margin-top: 14px; }

button {
  flex: 1; padding: 11px 16px;
  background: rgba(0,240,255,0.05);
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
  font-family: var(--font-hud);
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.15em;
  transition: all 0.2s;
  position: relative;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
button:hover {
  background: var(--cyan);
  color: #000;
  box-shadow: var(--cyan-glow);
}
button:active { transform: scale(0.97); }

.btn-clear {
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--muted);
  flex: 0 0 100px;
}
.btn-clear:hover { background: rgba(255,42,42,0.1); border-color: var(--red); color: var(--red); box-shadow: none; }

/* === RESULT AREA === */
.result-area { padding: 16px 20px 20px; min-height: 80px; }

.no-hit {
  color: var(--muted);
  font-size: 12px;
  padding: 20px 0;
  text-align: center;
  letter-spacing: 0.2em;
}

/* ================================
   HUMAN CARD — 検索結果カード
================================ */
.human-card {
  margin-bottom: 22px;
  background: rgba(0,6,15,0.8);
  border: 1px solid var(--cyan-border);
  position: relative;
  clip-path: polygon(
    0 0,
    calc(100% - 14px) 0,
    100% 14px,
    100% 100%,
    14px 100%,
    0 calc(100% - 14px)
  );
  animation: cardIn 0.3s ease;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 右上の斜めカット内部線 */
.human-card::after {
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 16px 16px 0;
  border-color: transparent var(--cyan) transparent transparent;
  opacity: 0.7;
}

/* カード上部バー */
.card-header-bar {
  background: linear-gradient(90deg, rgba(0,240,255,0.15), transparent);
  padding: 7px 16px;
  border-bottom: 1px solid var(--cyan-border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 9px; color: var(--muted);
  font-family: var(--font-hud);
  letter-spacing: 0.15em;
}

.card-id { color: var(--cyan); font-size: 10px; }

/* TOP FLEX */
.res-top-flex { display: flex; border-bottom: 1px dashed rgba(0,240,255,0.2); }

/* 左：フレーズ情報 */
.res-info-side {
  flex: 1; padding: 18px 20px;
  display: flex; flex-direction: column; justify-content: center;
}

.phrase-main {
  font-family: var(--font-hud);
  font-size: 24px; font-weight: 900;
  color: #fff;
  text-shadow: 0 0 15px rgba(0,240,255,0.4);
  margin-bottom: 8px;
}

.meaning-main {
  font-size: 17px; font-weight: bold;
  color: var(--cyan);
  margin-bottom: 10px;
  text-shadow: 0 0 8px rgba(0,240,255,0.5);
}

.kana-line {
  font-size: 12px; color: var(--muted);
  margin-bottom: 4px;
}
.kana-line span { color: #d0f8ff; font-size: 13px; }

.taboo-line {
  font-size: 10px; color: var(--red);
  margin-top: 10px;
  padding: 4px 8px;
  border-left: 2px solid var(--red);
  background: rgba(255,42,42,0.05);
  letter-spacing: 0.1em;
}

/* 右：モニター */
.res-monitor-side {
  width: 300px; padding: 16px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(0,240,255,0.02);
  border-left: 1px dashed rgba(0,240,255,0.2);
  position: relative;
}

.monitor-frame {
  width: 200px; height: 200px;
  border: 1px solid var(--cyan);
  background: radial-gradient(circle at 40% 40%, rgba(0,240,255,0.12) 0%, #000 70%);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.monitor-frame::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,240,255,0.04) 3px,
    rgba(0,240,255,0.04) 4px
  );
  pointer-events: none;
}

.monitor-frame img {
  max-width: 88%; max-height: 88%;
  filter: drop-shadow(0 0 6px var(--cyan));
  position: relative; z-index: 1;
}

.monitor-label {
  font-size: 8px; color: var(--muted);
  margin-top: 6px;
  font-family: var(--font-hud);
  letter-spacing: 0.2em;
}

.voice-btn {
  margin-top: 8px; width: 100%; flex: none;
  font-size: 9px; padding: 6px;
  letter-spacing: 0.1em;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

/* === DETAIL GRID === */
.human-detail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--cyan-border);
  gap: 1px;
  font-size: 10px;
}

.detail-row {
  display: flex; flex-direction: column;
  justify-content: center;
  background: #02050a;
  padding: 10px 12px;
  gap: 3px;
}

.detail-k {
  color: var(--muted);
  font-size: 8px;
  font-family: var(--font-hud);
  letter-spacing: 0.1em;
}

.detail-v {
  color: var(--cyan);
  font-size: 14px;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(0,240,255,0.5);
}

/* === SCORE AREA === */
.score-area {
  padding: 14px 20px;
  background: rgba(0,0,0,0.35);
  border-top: 1px solid rgba(0,240,255,0.1);
}

.score-title {
  font-family: var(--font-hud);
  font-size: 9px; color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.2em;
}

.bar-row {
  display: flex; align-items: center;
  gap: 10px; font-size: 9px;
  margin-bottom: 7px;
  font-family: var(--font-hud);
}

.bar-label { width: 55px; color: var(--muted); letter-spacing: 0.1em; }

.bar-bg {
  flex: 1; height: 5px;
  background: rgba(0,240,255,0.08);
  border: 1px solid rgba(0,240,255,0.1);
  position: relative;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--accent));
  box-shadow: 0 0 6px rgba(0,240,255,0.6);
  transition: width 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
}

.bar-fill::after {
  content: "";
  position: absolute;
  right: -2px; top: -2px;
  width: 4px; height: 9px;
  background: #fff;
  opacity: 0.8;
}

.bar-val {
  width: 32px;
  text-align: right;
  color: var(--cyan);
  font-size: 10px;
}

/* === EXAMPLE BOX === */
.example-box {
  padding: 14px 20px;
  border-top: 1px solid rgba(0,240,255,0.1);
  font-size: 11px;
}

.example-label {
  font-family: var(--font-hud);
  font-size: 8px; color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.2em;
}

.chunk-item {
  border-left: 2px solid var(--cyan);
  padding: 6px 12px;
  background: rgba(0,240,255,0.03);
}

.chunk-en { color: #fff; font-size: 13px; margin-bottom: 3px; }
.chunk-kana { color: var(--muted); font-size: 10px; }

/* === MODAL === */
.modal { display: none; position: fixed; inset: 0; z-index: 100; }
.modal.on { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.88); }
.modal-panel {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  background: #010d1a;
  border: 1px solid var(--cyan);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
  box-shadow: 0 0 40px rgba(0,240,255,0.2);
}

.modal-head {
  background: linear-gradient(90deg, rgba(0,240,255,0.15), transparent);
  color: var(--cyan);
  padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-hud);
  font-size: 11px; letter-spacing: 0.15em;
  border-bottom: 1px solid var(--cyan-border);
}

.modal-close {
  background: none; border: none;
  color: var(--cyan); font-size: 20px;
  cursor: pointer; flex: none;
  width: auto; padding: 0 4px;
  clip-path: none;
}
.modal-close:hover { background: none; color: #fff; box-shadow: none; }

.modal-body {
  padding: 18px 16px;
  font-size: 11px;
  line-height: 2;
}

.modal-body p {
  border-bottom: 1px solid rgba(0,240,255,0.08);
  padding-bottom: 8px; margin-bottom: 8px;
}

.modal-body b { color: var(--cyan); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .res-top-flex { flex-direction: column; }
  .res-monitor-side { width: 100%; border-left: none; border-top: 1px dashed rgba(0,240,255,0.2); }
  .human-detail { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .brand { font-size: 17px; }
  .phrase-main { font-size: 20px; }
}

/* =========================
   LITE DISPLAY ADD-ONS
========================= */

.kana-hot {
  font-family: var(--font-hud);
  font-size: 24px;          /* ENと同格 */
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 15px rgba(0,240,255,0.35);
  margin-top: 8px;
}

.kana-line .std-tag {
  opacity: 0.75;
  color: var(--muted);
  margin-right: 6px;
}

.do-not-use {
  margin-top: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(255,42,42,0.65);
  background: rgba(255,42,42,0.08);
  color: var(--red);
  font-family: var(--font-hud);
  letter-spacing: 0.08em;
}

/* CUT（NO_GO + cut / hard domains）時のカード外観 */
.human-card.is-cut {
  border-color: rgba(255,42,42,0.7);
  background: rgba(255,42,42,0.06);
}
.human-card.is-cut .phrase-main,
.human-card.is-cut .meaning-main,
.human-card.is-cut .kana-hot,
.human-card.is-cut .chunk-en,
.human-card.is-cut .chunk-kana {
  color: var(--red) !important;
  text-shadow: none !important;
}