:root {
  --bg: #071016;
  --bg-soft: #0b171f;
  --panel: rgba(16, 31, 41, .78);
  --panel-solid: #101f29;
  --panel-strong: #152833;
  --line: rgba(140, 194, 207, .16);
  --line-strong: rgba(97, 224, 207, .35);
  --text: #f4f8f9;
  --muted: #93a9b1;
  --mint: #61e0cf;
  --mint-strong: #27c7b4;
  --cyan: #58bfe8;
  --danger: #ff7e8a;
  --success: #69e6a6;
  --shadow: 0 24px 80px rgba(0, 0, 0, .34);
  --radius: 22px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f7f8;
  --bg-soft: #e9f1f3;
  --panel: rgba(255, 255, 255, .8);
  --panel-solid: #ffffff;
  --panel-strong: #edf5f6;
  --line: rgba(24, 72, 84, .13);
  --line-strong: rgba(18, 165, 148, .34);
  --text: #10242b;
  --muted: #617880;
  --mint: #079f8e;
  --mint-strong: #078979;
  --cyan: #168fbf;
  --danger: #c83f52;
  --success: #178758;
  --shadow: 0 24px 70px rgba(33, 79, 89, .14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
  transition: background .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }
.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

.ambient { position: fixed; border-radius: 50%; filter: blur(110px); pointer-events: none; opacity: .14; z-index: -1; }
.ambient-one { width: 520px; height: 520px; background: var(--mint); right: -220px; top: -180px; }
.ambient-two { width: 430px; height: 430px; background: var(--cyan); left: -260px; bottom: 5%; }

.site-header {
  width: min(1260px, calc(100% - 32px));
  min-height: 74px;
  margin: 18px auto 0;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: color-mix(in srgb, var(--panel-solid) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: 19px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .1);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 12px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: #071311; background: linear-gradient(135deg, var(--mint), #b1fff4); box-shadow: 0 8px 26px rgba(97, 224, 207, .24); }
.main-nav { display: flex; align-items: center; gap: 8px; }
.main-nav > a { padding: 9px 12px; border-radius: 11px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.main-nav > a:hover { color: var(--text); background: var(--panel-strong); }
.main-nav > a i { margin-right: 7px; color: var(--mint); }
.icon-button, .text-button { width: 40px; height: 40px; border: 1px solid var(--line); background: var(--panel-strong); border-radius: 12px; cursor: pointer; }
.icon-button:hover, .text-button:hover { border-color: var(--line-strong); }
.theme-dark-icon { display: none; }
[data-theme="light"] .theme-light-icon { display: none; }
[data-theme="light"] .theme-dark-icon { display: inline-block; }
.account-chip { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; font-weight: 600; }
.account-chip img { border-radius: 50%; }
.account-chip > i { width: 30px; height: 30px; display: grid; place-items: center; color: #fff; background: #5865f2; border-radius: 50%; }

.flash { width: min(760px, calc(100% - 40px)); margin: 20px auto -8px; padding: 13px 17px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--panel-solid); box-shadow: var(--shadow); }
.flash i { margin-right: 9px; color: var(--mint); }

.hero { min-height: 610px; padding-block: 76px 58px; display: grid; grid-template-columns: 1.08fr .92fr; gap: 64px; align-items: center; }
.eyebrow { color: var(--mint); font-size: .73rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow i { margin-right: 8px; }
.hero h1, .page-heading h1 { margin: 16px 0; letter-spacing: -.055em; line-height: 1.15; }
.hero h1 { font-size: clamp(2.7rem, 5vw, 5.15rem); }
.hero h1 span { background: linear-gradient(100deg, var(--mint), var(--cyan)); -webkit-background-clip: text; color: transparent; }
.hero-copy > p { max-width: 640px; color: var(--muted); font-size: 1.08rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 32px; }
.primary-button, .secondary-button, .danger-button {
  min-height: 46px; padding: 11px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 13px; border: 1px solid transparent; font-weight: 700; cursor: pointer;
}
.primary-button { color: #061512; background: linear-gradient(135deg, var(--mint), #9ef4e8); box-shadow: 0 12px 32px rgba(54, 211, 190, .2); }
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.04); }
.discord-button { color: #fff; background: #5865f2; box-shadow: 0 12px 32px rgba(88, 101, 242, .24); }
.secondary-button { border-color: var(--line); background: var(--panel-strong); }
.danger-button { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
button:disabled { opacity: .4; cursor: not-allowed; }
.security-note { color: var(--muted); font-size: .84rem; }
.security-note i { color: var(--mint); margin-right: 5px; }

.hero-gallery { position: relative; min-height: 460px; perspective: 900px; }
.gallery-card { position: absolute; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 22px; border: 1px solid var(--line-strong); border-radius: 24px; background: linear-gradient(145deg, color-mix(in srgb, var(--mint) 14%, var(--panel-solid)), var(--panel-solid)); box-shadow: var(--shadow); overflow: hidden; }
.gallery-card::after { content: ""; position: absolute; width: 150px; height: 150px; border-radius: 50%; background: var(--mint); filter: blur(65px); opacity: .18; right: -40px; top: -40px; }
.gallery-card i { font-size: 3rem; color: var(--mint); }
.gallery-card span { color: var(--muted); font-size: .7rem; letter-spacing: .15em; font-weight: 700; }
.card-a { width: 58%; height: 62%; left: 0; top: 19%; transform: rotate(-5deg); }
.card-b { width: 52%; height: 68%; right: 0; top: 3%; transform: rotate(6deg); }
.card-c { width: 48%; height: 53%; right: 11%; bottom: 0; transform: rotate(-2deg); }
.sync-pill { position: absolute; left: 31%; top: 4%; padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel-solid); box-shadow: var(--shadow); color: var(--mint); font-size: .8rem; font-weight: 700; z-index: 4; }
.sync-pill i { margin-right: 7px; }

.feature-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding-bottom: 70px; }
.feature-strip article { padding: 22px; display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); backdrop-filter: blur(12px); }
.feature-strip article > i { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 13px; color: var(--mint); background: color-mix(in srgb, var(--mint) 10%, transparent); }
.feature-strip strong, .feature-strip span { display: block; }
.feature-strip span { color: var(--muted); font-size: .82rem; margin-top: 2px; }

.page-heading { padding-block: 66px 28px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.page-heading h1 { font-size: clamp(2rem, 4vw, 3.5rem); }
.page-heading p { margin: 0; color: var(--muted); }
.segmented-control { padding: 4px; display: flex; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.segmented-control a { padding: 8px 15px; border-radius: 9px; color: var(--muted); font-size: .84rem; font-weight: 700; }
.segmented-control a.active { color: #061512; background: var(--mint); }

.gallery-grid { padding-block: 18px 64px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.generation-card { min-width: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); overflow: hidden; box-shadow: 0 14px 42px rgba(0, 0, 0, .12); transition: transform .2s ease, border-color .2s ease; }
.generation-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.generation-image { position: relative; aspect-ratio: 4 / 3; background: var(--panel-strong); overflow: hidden; }
.generation-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.generation-card:hover img { transform: scale(1.025); }
.ratio-badge, .private-badge { position: absolute; top: 12px; padding: 5px 9px; border-radius: 999px; color: #fff; background: rgba(5, 15, 21, .7); backdrop-filter: blur(10px); font-size: .7rem; }
.ratio-badge { left: 12px; }
.private-badge { right: 12px; }
.generation-copy { padding: 17px; }
.generation-copy p { height: 3.25em; margin: 0 0 15px; overflow: hidden; font-weight: 600; }
.card-meta { display: flex; flex-wrap: wrap; gap: 10px 14px; color: var(--muted); font-size: .72rem; }
.card-meta i { margin-right: 5px; color: var(--mint); }
.empty-state { grid-column: 1 / -1; padding: 80px 24px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 24px; background: var(--panel); }
.empty-state > i { font-size: 2.5rem; color: var(--mint); }
.empty-state h2 { margin-bottom: 5px; }
.empty-state p { color: var(--muted); }
.pagination { padding-bottom: 70px; display: flex; justify-content: center; align-items: center; gap: 24px; }
.pagination a { color: var(--mint); font-weight: 700; }

.detail-layout { padding-block: 54px 80px; display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(380px, .94fr); gap: 30px; align-items: start; }
.detail-image-panel, .detail-panel, .admin-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.detail-image-panel { padding: 14px; position: sticky; top: 108px; }
.detail-image-panel img { width: 100%; max-height: 78vh; object-fit: contain; border-radius: 14px; background: var(--panel-strong); }
.detail-panel { padding: 30px; }
.back-link { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 28px; color: var(--muted); font-size: .85rem; }
.detail-panel h1 { margin: 10px 0; font-size: 2.2rem; }
.prompt-text { padding-bottom: 22px; color: var(--text); border-bottom: 1px solid var(--line); white-space: normal; }
.style-box { margin: 20px 0; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-strong); }
.style-box span, .style-box strong { display: block; }
.style-box span { color: var(--muted); font-size: .72rem; }
.metadata-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 22px 0; background: var(--line); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.metadata-grid div { padding: 13px; background: var(--panel-solid); }
.metadata-grid dt { color: var(--muted); font-size: .7rem; }
.metadata-grid dd { margin: 2px 0 0; font-size: .86rem; font-weight: 700; word-break: break-word; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stats-grid article { padding: 20px; display: flex; align-items: center; gap: 15px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.stats-grid i { color: var(--mint); font-size: 1.3rem; }
.stats-grid span, .stats-grid strong { display: block; }
.stats-grid span { color: var(--muted); font-size: .76rem; }
.stats-grid strong { font-size: 1.35rem; }
.admin-grid { padding-bottom: 80px; display: grid; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); gap: 20px; align-items: start; }
.admin-panel { padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.panel-heading h2 { margin: 3px 0 0; }
.panel-heading > i { color: var(--mint); font-size: 1.4rem; }
.count-pill { padding: 5px 10px; color: var(--mint); border: 1px solid var(--line-strong); border-radius: 999px; font-size: .72rem; }
.stack-form { display: grid; gap: 15px; }
.stack-form label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.stack-form input, .stack-form textarea { width: 100%; padding: 12px 13px; color: var(--text); border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); outline: none; resize: vertical; }
.stack-form input:focus, .stack-form textarea:focus { border-color: var(--mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 13%, transparent); }
.user-list { display: grid; gap: 9px; }
.user-row { padding: 13px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-soft); }
.user-status { font-size: .58rem; }
.user-status.enabled { color: var(--success); }
.user-status.disabled { color: var(--muted); }
.user-identity { min-width: 0; }
.user-identity strong, .user-identity code, .user-identity span { display: block; }
.user-identity code { color: var(--mint); font-size: .75rem; overflow-wrap: anywhere; }
.user-identity span { color: var(--muted); font-size: .72rem; }

.error-state { min-height: 62vh; display: grid; place-content: center; justify-items: center; text-align: center; }
.error-state > span { font-size: clamp(5rem, 14vw, 10rem); font-weight: 800; letter-spacing: -.08em; color: color-mix(in srgb, var(--mint) 35%, transparent); line-height: 1; }
.error-state h1 { margin-bottom: 28px; }
.site-footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 36px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); border-top: 1px solid var(--line); font-size: .75rem; }
.site-footer i { color: var(--mint); margin-right: 6px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 58px; }
  .hero-gallery { min-height: 390px; }
  .feature-strip, .stats-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout, .admin-grid { grid-template-columns: 1fr; }
  .detail-image-panel { position: static; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 1180px); }
  .site-header { width: calc(100% - 16px); margin-top: 8px; top: 6px; }
  .brand span:last-child, .account-chip span, .main-nav > a span { display: none; }
  .main-nav > a { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; }
  .main-nav > a i { margin: 0; }
  .hero { min-height: auto; padding-top: 46px; }
  .hero h1 { font-size: 2.55rem; }
  .hero-gallery { min-height: 310px; }
  .gallery-card { padding: 15px; }
  .gallery-card i { font-size: 2rem; }
  .page-heading { padding-top: 44px; align-items: start; flex-direction: column; }
  .gallery-grid { grid-template-columns: 1fr; }
  .metadata-grid { grid-template-columns: 1fr; }
  .detail-panel { padding: 22px; }
  .user-row { grid-template-columns: auto 1fr; }
  .user-row form { grid-column: 2; }
  .site-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
