/* style.css for image2 aesthetic */
:root {
  --bg: #070914;
  --panel: rgba(15, 20, 38, 0.78);
  --panel-strong: rgba(20, 28, 52, 0.92);
  --border: rgba(152, 201, 255, 0.22);
  --text: #edf6ff;
  --muted: #9fb0c8;
  --accent: #7dd3fc;
  --accent-2: #c084fc;
  --accent-3: #facc15;
  --danger: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --shell-width: 1240px;
  --shell-gutter: 32px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-monospace, SFMono-Regular, Consolas, Monaco, "Noto Sans TC", monospace;
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.22), transparent 30rem),
    radial-gradient(circle at bottom right, rgba(192, 132, 252, 0.2), transparent 32rem),
    linear-gradient(135deg, #060712 0%, #0a1024 48%, #090714 100%);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  content: "";
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

/* 背景光球 */
.bg-orb {
  position: fixed;
  z-index: -2;
  width: min(360px, 62vw);
  height: min(360px, 62vw);
  border-radius: 999px;
  filter: blur(28px);
  opacity: 0.45;
  pointer-events: none;
}
.bg-orb-one {
  top: 80px;
  right: 10%;
  background: #38bdf8;
}
.bg-orb-two {
  bottom: 30px;
  left: 8%;
  background: #a855f7;
}

/* 主要布局 */
.game-shell {
  width: min(var(--shell-width), calc(100% - var(--shell-gutter)));
  margin: 0 auto;
  padding: 28px 0 max(28px, env(safe-area-inset-bottom));
}

/* 頭部區域 */
.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.16), rgba(192, 132, 252, 0.1)),
    rgba(15, 20, 38, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero > div:first-child {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: 52px;
  line-height: 1.08;
  text-shadow: 0 0 28px rgba(125, 211, 252, 0.35);
  overflow-wrap: anywhere;
}

.subtitle {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.hero-card {
  display: grid;
  min-width: 210px;
  max-width: 260px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(250, 204, 21, 0.25);
  border-radius: 24px;
  background: rgba(250, 204, 21, 0.08);
  color: #fde68a;
  text-align: center;
  overflow-wrap: anywhere;
}

.sigil {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 18px;
  background: rgba(250, 204, 21, 0.1);
  font-size: 34px;
}

/* 面板 */
.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

/* 狀態面板 */
.status-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
}

.status-panel div {
  min-width: 0;
  min-height: 48px;
  padding: 12px;
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.1), rgba(192, 132, 252, 0.08));
  color: #dff4ff;
  overflow-wrap: anywhere;
}

/* 主要布局區域 */
.layout {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

/* 左側指令卡 */
.command-card {
  padding: 18px;
  min-width: 0;
}

.command-card h2 {
  margin: 0 0 12px;
  color: #fff;
  font-size: 16px;
}

.command-card p {
  margin: 8px 0;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 22px;
}

.command-grid span,
code {
  display: block;
  padding: 9px 10px;
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: 12px;
  background: rgba(6, 10, 24, 0.5);
  color: #bae6fd;
  overflow-wrap: anywhere;
}

/* 日誌面板 */
.log-panel {
  min-width: 0;
  height: min(620px, 64vh);
  min-height: 430px;
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  background:
    linear-gradient(180deg, rgba(8, 13, 30, 0.82), rgba(9, 11, 24, 0.88)),
    var(--panel-strong);
}

.log-panel::-webkit-scrollbar {
  width: 10px;
}

.log-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(var(--accent), var(--accent-2));
}

/* 指令輸入 */
.command-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 18px;
}

input {
  width: 100%;
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 18px;
  outline: none;
  background: rgba(6, 10, 24, 0.82);
  color: #fff;
  font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.14);
}

button {
  min-width: 92px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06101f;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(125, 211, 252, 0.22);
}

button:hover {
  transform: translateY(-1px);
}

.hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

/* PC: wide desktop and notebook screens */
@media (min-width: 1101px) {
  .command-card {
    position: sticky;
    top: 18px;
  }
}

/* Tablet: portrait and smaller landscape screens */
@media (min-width: 700px) and (max-width: 1100px) {
  :root {
    --shell-width: 940px;
    --shell-gutter: 28px;
  }

  h1 {
    font-size: 44px;
  }

  .hero {
    padding: 22px;
  }

  .hero-card {
    min-width: 190px;
    max-width: 220px;
  }

  .status-panel {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .status-panel div {
    min-height: 44px;
    padding: 10px;
    font-size: 13px;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .command-card {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
    gap: 10px 18px;
    padding: 16px;
  }

  .command-card h2,
  .command-card p,
  .command-card .command-grid,
  .command-card .map-panel,
  .command-card .map-help {
    margin-top: 0;
  }

  .command-card h2:first-of-type,
  .command-grid {
    grid-column: 1;
  }

  .command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-self: start;
    margin-bottom: 0;
  }

  .command-card h2:nth-of-type(2),
  .command-card p {
    grid-column: 2;
  }

  .command-card h2:nth-of-type(3),
  .map-panel,
  .map-help {
    grid-column: 2;
  }

  .log-panel {
    height: min(560px, 52vh);
    min-height: 380px;
  }
}

/* Mobile: kept functional for now; final mobile polish comes later. */
@media (max-width: 699px) {
  .game-shell {
    width: min(100% - 24px, 720px);
    padding-top: 18px;
  }

  .hero {
    flex-direction: column;
    padding: 20px;
  }

  .hero-card {
    width: 100%;
    max-width: none;
    min-width: 0;
    grid-template-columns: auto 1fr;
    justify-items: start;
    text-align: left;
  }

  .sigil {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 28px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .command-form {
    grid-template-columns: 1fr;
  }

  button {
    min-height: 48px;
  }

  .log-panel {
    height: 48vh;
    min-height: 320px;
  }
}

@media (max-width: 560px) {
  .game-shell {
    width: min(100% - 16px, 520px);
    padding-top: 8px;
  }

  .hero,
  .panel {
    border-radius: 18px;
  }

  .hero {
    gap: 14px;
    margin-bottom: 12px;
    padding: 16px;
  }

  .eyebrow {
    font-size: 11px;
  }

  h1 {
    font-size: 34px;
  }

  .subtitle {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.65;
  }

  .hero-card {
    padding: 12px;
  }

  .status-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
  }

  .status-panel div {
    min-height: 44px;
    padding: 10px;
    border-radius: 12px;
    font-size: 13px;
  }

  .layout {
    gap: 12px;
  }

  .command-card,
  .log-panel {
    padding: 14px;
  }

  .command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
  }

  .command-grid span,
  code {
    padding: 8px;
    border-radius: 10px;
    font-size: 12px;
  }

  .log-panel {
    height: 46vh;
    min-height: 280px;
    line-height: 1.6;
  }

  .command-form {
    gap: 8px;
    margin-top: 12px;
  }

  input {
    padding: 13px 14px;
    border-radius: 14px;
    font-size: 16px;
  }

  button {
    border-radius: 14px;
  }

  .hint {
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 30px;
  }

  .status-panel {
    grid-template-columns: 1fr;
  }

  .command-grid {
    grid-template-columns: 1fr;
  }
}

/* 地圖系統 */
.map-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 10px;
}

.map-cell {
  display: grid;
  align-content: center;
  min-height: 54px;
  aspect-ratio: 1 / 0.86;
  padding: 8px;
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: 14px;
  background: rgba(6, 10, 24, 0.45);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.map-cell-empty {
  opacity: 0.18;
}

.map-cell-current {
  border-color: rgba(250, 204, 21, 0.75);
  background:
    radial-gradient(circle at top, rgba(250, 204, 21, 0.28), transparent 70%),
    rgba(125, 211, 252, 0.14);
  color: #fff7c2;
  box-shadow: 0 0 28px rgba(250, 204, 21, 0.2);
}

.map-cell-monster {
  color: #fecdd3;
}

.map-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}
