:root {
  --desktop-bg: linear-gradient(135deg, #ffd1e8 0%, #e0c3fc 35%, #b3d4fc 70%, #a0f0e8 100%);
  --face: #c0c0c0;
  --face-light: #dfdfdf;
  --face-dark: #808080;
  --face-darker: #000000;
  --white: #ffffff;
  --window-bg: #ece9e4;
  --text: #000000;
  --muted: #4b4b4b;
  --accent: #ff5c8a;
  --titlebar-a: #00048a;
  --titlebar-b: #1084d0;
  --good: #0a7a3d;
  --warn: #9a6b00;
  --bad: #a3123a;
  --font: Tahoma, "MS UI Gothic", "Hiragino Sans", "Yu Gothic", sans-serif;
  --mono: "Courier New", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--desktop-bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
}

/* Win98風の立体ボーダー（外側が凸） */
.raised {
  box-shadow:
    inset -1px -1px 0 var(--face-darker),
    inset 1px 1px 0 var(--white),
    inset -2px -2px 0 var(--face-dark),
    inset 2px 2px 0 var(--face-light);
}
.sunken {
  box-shadow:
    inset -1px -1px 0 var(--white),
    inset 1px 1px 0 var(--face-darker),
    inset -2px -2px 0 var(--face-light),
    inset 2px 2px 0 var(--face-dark);
}

header {
  padding: 6px 10px;
  background: linear-gradient(90deg, var(--titlebar-a), var(--titlebar-b));
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--face-darker);
}

header h1 {
  font-size: 0.95rem;
  margin: 0;
  color: #fff;
  font-weight: bold;
  font-family: var(--font);
  letter-spacing: 0.01em;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}
header a.btn { margin: 0; }

main { padding: 24px; max-width: 1200px; margin: 0 auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  background: var(--face);
  border: none;
  border-radius: 0;
  padding: 3px;
  box-shadow:
    inset -1px -1px 0 var(--face-darker),
    inset 1px 1px 0 var(--white),
    inset -2px -2px 0 var(--face-dark),
    inset 2px 2px 0 var(--face-light);
  margin-bottom: 4px;
}

/* Windows 98風タイトルバー：グラデーション＋最小化/最大化/閉じるボタン */
.window-titlebar {
  margin: 0 0 10px 0;
  padding: 4px 4px 4px 8px;
  background: linear-gradient(90deg, var(--titlebar-a), var(--titlebar-b));
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.window-titlebar h2, .window-titlebar h3 {
  margin: 0;
  color: #fff;
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 0.01em;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.window-titlebar .win-controls {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  margin-left: 8px;
}
.window-titlebar .win-controls span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 15px;
  background: var(--face);
  color: #000;
  font-size: 0.6rem;
  font-family: var(--font);
  line-height: 1;
  box-shadow:
    inset -1px -1px 0 var(--face-darker),
    inset 1px 1px 0 var(--white),
    inset -2px -2px 0 var(--face-dark),
    inset 2px 2px 0 var(--face-light);
}

.card > *:not(.window-titlebar) { padding-left: 15px; padding-right: 15px; }
.card > *:last-child:not(.window-titlebar) { padding-bottom: 15px; }
.card > p:first-of-type, .card > div:not(.window-titlebar):first-of-type { margin-top: 12px; }

.card h2, .card h3 { margin-top: 0; }

.stat-row { display: flex; justify-content: space-between; margin: 6px 0; font-size: 0.9rem; padding-left: 15px; padding-right: 15px; }
.stat-row .label { color: var(--muted); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--mono);
  border: 1px solid var(--face-darker);
}
.badge.healthy { background: #cdf5d8; color: var(--good); }
.badge.discovery, .badge.thumbnail_caption, .badge.bio_highlight, .badge.external_funnel {
  background: #ffd7dd; color: var(--bad);
}
.badge.insufficient_data { background: #fff1c2; color: var(--warn); }
.badge.viral { background: #ffd9e6; color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: var(--white); }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--face-dark); }
th { background: var(--face-light); color: #000; font-weight: bold; border-bottom: 2px solid var(--face-darker); }

.empty-state { color: var(--muted); text-align: center; padding: 60px 20px; }

.btn {
  display: inline-block;
  background: var(--face);
  color: #000;
  padding: 6px 14px;
  border-radius: 0;
  text-decoration: none;
  font-size: 0.82rem;
  font-family: var(--font);
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow:
    inset -1px -1px 0 var(--face-darker),
    inset 1px 1px 0 var(--white),
    inset -2px -2px 0 var(--face-dark),
    inset 2px 2px 0 var(--face-light);
}
.btn:active {
  box-shadow:
    inset 1px 1px 0 var(--face-darker),
    inset -1px -1px 0 var(--white);
  padding: 7px 13px 5px 15px;
}
.btn.secondary { background: var(--face); }

input[type="text"] {
  background: var(--white);
  border: none;
  box-shadow:
    inset -1px -1px 0 var(--white),
    inset 1px 1px 0 var(--face-darker),
    inset -2px -2px 0 var(--face-light),
    inset 2px 2px 0 var(--face-dark);
  padding: 6px 8px;
  font-family: var(--font);
}

canvas {
  background: var(--white);
  box-shadow:
    inset -1px -1px 0 var(--white),
    inset 1px 1px 0 var(--face-darker),
    inset -2px -2px 0 var(--face-light),
    inset 2px 2px 0 var(--face-dark);
  padding: 8px;
}

.heatmap-cell {
  width: 32px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  color: #000;
  border: 1px solid var(--face-dark);
  margin: 1px;
}

.section { margin-bottom: 28px; }

.recommend-list { padding-left: 20px; }
.recommend-list li { margin-bottom: 6px; }

.report-view {
  background: var(--white);
  color: #000;
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 16px;
  white-space: pre-wrap;
  line-height: 1.7;
  max-height: 480px;
  overflow-y: auto;
  box-shadow:
    inset -1px -1px 0 var(--white),
    inset 1px 1px 0 var(--face-darker),
    inset -2px -2px 0 var(--face-light),
    inset 2px 2px 0 var(--face-dark);
}
.report-view h1, .report-view h2, .report-view h3 { font-family: var(--font); }
.report-view table { margin: 8px 0; }
