/* =============================================
 * shadcn/ui design system — monochrome
 * https://ui.shadcn.com/themes
 * ============================================= */

:root {
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --popover: #ffffff;
  --popover-foreground: #09090b;
  --primary: #09090b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #09090b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --accent-foreground: #09090b;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --success: #22c55e;
  --warning: #eab308;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #09090b;
  --radius: 0.5rem;
  --radius-sm: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.dark {
  --background: #09090b;
  --foreground: #fafafa;
  --card: #18181b;
  --card-foreground: #fafafa;
  --popover: #18181b;
  --popover-foreground: #fafafa;
  --primary: #fafafa;
  --primary-foreground: #18181b;
  --secondary: #27272a;
  --secondary-foreground: #fafafa;
  --muted: #27272a;
  --muted-foreground: #a1a1aa;
  --accent: #27272a;
  --accent-foreground: #fafafa;
  --destructive: #f87171;
  --destructive-foreground: #fafafa;
  --success: #4ade80;
  --warning: #facc15;
  --border: #27272a;
  --input: #27272a;
  --ring: #fafafa;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.2);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.2);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* === shadcn/ui-style utilities === */
.bg-background { background: var(--background); }
.bg-foreground { background: var(--foreground); }
.bg-card { background: var(--card); }
.bg-popover { background: var(--popover); }
.bg-primary { background: var(--primary); }
.bg-secondary { background: var(--secondary); }
.bg-muted { background: var(--muted); }
.bg-accent { background: var(--accent); }
.bg-destructive { background: var(--destructive); }
.text-foreground { color: var(--foreground); }
.text-card-foreground { color: var(--card-foreground); }
.text-popover-foreground { color: var(--popover-foreground); }
.text-primary-foreground { color: var(--primary-foreground); }
.text-secondary-foreground { color: var(--secondary-foreground); }
.text-muted-foreground { color: var(--muted-foreground); }
.text-accent-foreground { color: var(--accent-foreground); }
.text-destructive-foreground { color: var(--destructive-foreground); }
.text-destructive { color: var(--destructive); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.border-border { border-color: var(--border); }
.border-input { border-color: var(--input); }
.ring-ring { --tw-ring-color: var(--ring); }
.ring-offset-background { --tw-ring-offset-color: var(--background); }

/* === shadcn/ui components === */

/* Button */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  min-height: 2.25rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--accent); }
button:disabled, .btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.btn-primary:hover { opacity: 0.85; background: var(--primary); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); border-color: var(--border); }
.btn-secondary:hover { background: var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--accent); }
.btn-outline { background: transparent; }
.btn-outline:hover { background: var(--accent); }
.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); border-color: var(--destructive); }
.btn-destructive:hover { opacity: 0.85; }
.btn-sm { min-height: 2rem; padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { min-height: 2.75rem; padding: 0.75rem 1.5rem; }
.btn-icon { min-width: 2.25rem; min-height: 2.25rem; padding: 0; justify-content: center; }
.btn-full { width: 100%; }

/* Input */
input, textarea, select {
  display: block;
  width: 100%;
  min-height: 2.25rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background: var(--background);
  color: var(--foreground);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--muted-foreground); }
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; padding-right: 2rem; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%2371717a' viewBox='0 0 24 24'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 9l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 1rem; }

/* Label */
label { display: block; font-size: 0.8125rem; font-weight: 500; margin-bottom: 0.375rem; }

/* Card */
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-sm); }
.card-header { padding: 1.25rem 1.25rem 0; }
.card-content { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem 1.25rem; }
.card-footer-border { border-top: 1px solid var(--border); }

/* Badge */
.badge {
  display: inline-flex; align-items: center; border-radius: 9999px;
  font-size: 0.75rem; font-weight: 600; padding: 0.125rem 0.625rem;
  min-height: 1.25rem; border: 1px solid var(--border); background: transparent;
  color: var(--muted-foreground);
}
.badge-success { border-color: var(--success); color: var(--success); background: transparent; }
.badge-error { border-color: var(--destructive); color: var(--destructive); background: transparent; }
.badge-warning { border-color: var(--warning); color: var(--warning); background: transparent; }

/* Alert */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.8125rem; border: 1px solid var(--border); }
.alert-error { border-color: var(--destructive); color: var(--destructive); }
.alert-success { border-color: var(--success); color: var(--success); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th { border-bottom: 1px solid var(--border); color: var(--muted-foreground); font-size: 0.75rem; font-weight: 600; padding: 0.625rem 0.75rem; text-align: left; white-space: nowrap; }
table td { border-bottom: 1px solid var(--border); font-size: 0.8125rem; padding: 0.75rem; vertical-align: middle; }
table tr:hover td { background: var(--muted); }
table tr:last-child td { border-bottom: none; }

/* Dialog / Modal */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(0,0,0,0.6); }
.dialog { width: 100%; max-width: 28rem; max-height: 90vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-xl); padding: 1.5rem; }
.dialog-sm { max-width: 22rem; }
.dialog-lg { max-width: 36rem; }

/* Separator */
.separator { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* Spinner */
.spinner {
  display: inline-block; width: 1.25rem; height: 1.25rem;
  border: 2px solid var(--border); border-top-color: var(--foreground);
  border-radius: 50%; animation: spin .6s linear infinite;
}
.spinner-lg { width: 2.5rem; height: 2.5rem; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Nav header */
.nav { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--background) 88%, transparent); backdrop-filter: blur(12px); }
.nav-inner { max-width: 1280px; margin: 0 auto; padding: 0 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.25rem; }
.nav-brand { display: flex; align-items: center; gap: 0.75rem; }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); margin-bottom: 1.25rem; }
.toolbar-group { display: flex; align-items: center; gap: 0.5rem; }
.toolbar-label { font-size: 0.8125rem; color: var(--muted-foreground); white-space: nowrap; }

/* Game card grid */
.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
@media (min-width: 540px) { .game-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; } }
@media (min-width: 768px) { .game-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .game-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1280px) { .game-grid { grid-template-columns: repeat(6, 1fr); } }

.game-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); overflow: hidden; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.game-card:hover { border-color: var(--ring); box-shadow: var(--shadow-md); }
.game-card-icon { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.game-card-icon img { width: 100%; height: 100%; object-fit: contain; }
.game-card-body { padding: 0.625rem; border-top: 1px solid var(--border); }
.game-card-title { font-size: 0.75rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-card-sub { font-size: 0.6875rem; color: var(--warning); margin-top: 0.125rem; }
.game-card-disabled { opacity: 0.55; cursor: default; }
.game-card-disabled:hover { border-color: var(--border); box-shadow: none; }

/* State boxes */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1rem; text-align: center; }
.state-icon { width: 3.5rem; height: 3.5rem; border-radius: 9999px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; color: var(--muted-foreground); }
.state p { margin-bottom: 1.25rem; color: var(--muted-foreground); font-size: 0.875rem; }
.state-icon-sm { width: 2.75rem; height: 2.75rem; border-radius: 9999px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Dropdown */
.dropdown { position: absolute; top: calc(100% + 0.375rem); right: 0; min-width: 14rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--popover); box-shadow: var(--shadow-lg); z-index: 50; padding: 0.375rem; }
.dropdown-hdr { padding: 0.5rem 0.625rem; border-bottom: 1px solid var(--border); margin-bottom: 0.25rem; }
.dropdown-hdr-name { font-size: 0.8125rem; font-weight: 600; }
.dropdown-hdr-sub { font-size: 0.6875rem; color: var(--muted-foreground); }
.dropdown-item { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.5rem 0.625rem; border-radius: var(--radius-sm); font-size: 0.8125rem; color: var(--foreground); background: none; border: none; cursor: pointer; text-align: left; text-decoration: none; }
.dropdown-item:hover { background: var(--accent); }
.dropdown-item-danger { color: var(--destructive); }

/* Avatar button */
.avatar { display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 9999px; border: 1px solid var(--border); background: var(--card); font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: background .15s; }
.avatar:hover { background: var(--muted); }

/* Account list item */
.acct-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: background .15s, border-color .15s; }
.acct-item:hover { background: var(--muted); border-color: var(--ring); }
.acct-item.active { border-color: var(--ring); background: var(--accent); }
.acct-item-info { min-width: 0; }
.acct-item-name { font-size: 0.875rem; font-weight: 500; }
.acct-item-sub { font-size: 0.75rem; color: var(--muted-foreground); }

/* Section heading */
.section-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem; }

/* Stream page styles live in templates/stream.html (page-scoped) */

/* === Self-hosted utilities (no CDN dependency) === */
.hidden { display: none !important; }
.fixed { position: fixed; }
.right-3 { right: 0.75rem; }
.top-3 { top: 0.75rem; }
.z-\[70\] { z-index: 70; }
.w-3\.5 { width: 0.875rem; }
.h-3\.5 { height: 0.875rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-full { width: 100%; }
.h-auto { height: auto; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
.container-xs { width: 100%; max-width: 24rem; margin: 0 auto; }

/* Theme-dependent visibility (brand wordmark light/dark swap) */
html.dark .dark\:hidden { display: none !important; }
html.dark .dark\:block { display: block !important; }
html:not(.dark) .dark\:block { display: none !important; }

/* Aliases used by admin panel / stream templates */
.nav-header { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--background) 88%, transparent); backdrop-filter: blur(12px); }
.nav-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.25rem; }
.nav-brand-icon { display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.modal { width: 100%; max-width: 28rem; max-height: 90vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-xl); padding: 1.5rem; }
.empty-icon { width: 3.5rem; height: 3.5rem; border-radius: 9999px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted-foreground); }
