/* ============================================
   Quick Drop
   loject.jp の SIGNAL デザイン (配色・書体・部品) に合わせる。
   ウェブフォントと外部資源は読み込まない (CSP で 'self' 以外を許可しないため)。
   ============================================ */

:root {
  --hue: 212;

  --bg-primary: #04050b;
  --bg-secondary: #090b16;
  --bg-tertiary: #10131f;

  --text-primary: #f4f4f7;
  --text-secondary: #a9adbe;
  --text-muted: #8f93a6;

  --accent: hsl(var(--hue) 92% 66%);
  --accent-hover: hsl(var(--hue) 92% 74%);
  --accent-light: hsl(var(--hue) 92% 66% / 0.14);
  --accent-line: hsl(var(--hue) 92% 66% / 0.4);

  --success: #7cf5c8;
  --success-light: rgba(124, 245, 200, 0.12);
  --warning: #ffd166;
  --warning-light: rgba(255, 209, 102, 0.12);
  --error: #ff6b81;
  --error-light: rgba(255, 107, 129, 0.12);

  --border-light: rgba(255, 255, 255, 0.14);
  --border-medium: rgba(255, 255, 255, 0.26);
  --divider: rgba(255, 255, 255, 0.08);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;

  --pad: clamp(16px, 4vw, 32px);
}

/* --- Base ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* loject.jp のシェーダ背景をコストゼロで模した地。アニメーションは掛けない */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(58% 52% at 18% 0%, hsl(var(--hue) 90% 40% / 0.28), transparent 68%),
    radial-gradient(52% 48% at 88% 12%, hsl(calc(var(--hue) + 120) 85% 45% / 0.14), transparent 66%),
    var(--bg-primary);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 420px 420px;
}

::selection {
  background: var(--accent);
  color: #000;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

a {
  color: var(--accent);
}

[hidden] {
  display: none !important;
}

/* --- Layout ---------------------------------------------------------------- */

.site {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--pad);
}

.site-wide {
  max-width: 920px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
}

.wordmark i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.nav {
  display: flex;
  gap: 18px;
}

.nav a {
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
}

.nav a:hover {
  color: var(--text-primary);
}

.title {
  font-size: clamp(26px, 5.4vw, 36px);
  line-height: 1.35;
  letter-spacing: 0.02em;
  margin: 20px 0 8px;
}

.lead {
  color: var(--text-secondary);
  margin: 0 0 28px;
}

.sec-head {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.sec-head b {
  color: var(--accent);
  font-weight: 400;
}

.stack > * + * {
  margin-top: 16px;
}

.footer {
  margin-top: 56px;
  padding: 24px 0 48px;
  border-top: 1px solid var(--divider);
  color: var(--text-muted);
  font-size: 13px;
}

.footer a {
  color: var(--text-secondary);
}

/* --- Surfaces -------------------------------------------------------------- */

.panel {
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: rgba(9, 11, 22, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 20px;
}

@media (min-width: 640px) {
  .panel {
    padding: 28px;
  }
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: rgba(9, 11, 22, 0.5);
}

.tab {
  min-height: 46px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--accent-light);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* --- Forms ----------------------------------------------------------------- */

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.label {
  font-size: 14px;
  font-weight: 600;
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  /* 16px 未満だと iOS Safari がフォーカス時に画面を拡大する */
  font-size: 16px;
  color: var(--text-primary);
  background: rgba(4, 5, 11, 0.72);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-medium);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.input-keyword {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.06em;
}

.textarea {
  min-height: 7rem;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.select option {
  background: var(--bg-secondary);
}

.row {
  display: flex;
  gap: 8px;
}

.row > .input {
  flex: 1;
  min-width: 0;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checks li {
  padding: 1px 10px;
  font-size: 12px;
  border: 1px solid var(--divider);
  border-radius: 999px;
  color: var(--text-muted);
}

.checks li[data-ok="true"] {
  color: var(--success);
  border-color: rgba(124, 245, 200, 0.4);
  background: var(--success-light);
}

.drop {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 26px 16px;
  text-align: center;
  color: var(--text-secondary);
  border: 1.5px dashed var(--border-medium);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 150ms var(--ease-out), background 150ms var(--ease-out);
}

.drop strong {
  color: var(--text-primary);
}

.drop[data-over="true"] {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* --- Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out),
    color 150ms var(--ease-out);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04050b;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-default {
  background: rgba(9, 11, 22, 0.5);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-default:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--error-light);
  border-color: rgba(255, 107, 129, 0.4);
  color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  border-color: var(--error);
}

.btn-sm {
  min-height: 36px;
  padding: 0.35rem 0.8rem;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Feedback -------------------------------------------------------------- */

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid;
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.notice-error {
  color: var(--error);
  border-color: rgba(255, 107, 129, 0.4);
  background: var(--error-light);
}

.notice-success {
  color: var(--success);
  border-color: rgba(124, 245, 200, 0.4);
  background: var(--success-light);
}

.notice-info {
  color: var(--text-secondary);
  border-color: var(--border-light);
  background: rgba(255, 255, 255, 0.03);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  color: var(--text-secondary);
}

.badge-warning {
  color: var(--warning);
  border-color: rgba(255, 209, 102, 0.4);
  background: var(--warning-light);
}

/* --- Lists ----------------------------------------------------------------- */

.items {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: rgba(11, 14, 26, 0.62);
}

.item-name {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.item-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.item .meter {
  grid-column: 1 / -1;
}

.meter {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.meter > i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 200ms linear;
}

.meter[data-state="done"] > i {
  background: var(--success);
}

.meter[data-state="error"] > i {
  background: var(--error);
}

.text-card {
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: rgba(11, 14, 26, 0.62);
}

.text-card pre {
  margin: 0 0 10px;
  max-height: 50vh;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* --- Folder ---------------------------------------------------------------- */

.folder-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 20px;
}

.countdown {
  font-family: var(--font-mono);
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.countdown[data-soon="true"] {
  color: var(--warning);
}

.section {
  margin-top: 28px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 16px;
}

/* --- Docs ------------------------------------------------------------------ */

.doc h2 {
  margin: 44px 0 12px;
  padding-top: 20px;
  font-size: 21px;
  border-top: 1px solid var(--divider);
}

.doc h3 {
  margin: 28px 0 8px;
  font-size: 16px;
}

.doc p,
.doc li {
  color: var(--text-secondary);
}

.doc strong {
  color: var(--text-primary);
}

.doc code {
  padding: 0.1em 0.35em;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 4px;
}

.code {
  position: relative;
  margin: 10px 0 14px;
}

.code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-primary);
  background: #070912;
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.code pre code {
  padding: 0;
  font-size: inherit;
  background: none;
}

.code .btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* コピーボタンに本文が隠れないよう、ボタンの幅だけ右を空ける */
.code pre {
  padding-right: 84px;
}

.scroll-x {
  overflow-x: auto;
}

.table {
  width: 100%;
  font-size: 14px;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--divider);
}

.table th {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
}

.table td {
  color: var(--text-secondary);
}

.panel .field:last-child {
  margin-bottom: 0;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.toc a {
  color: var(--text-secondary);
}

/* --- Utilities ------------------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
