:root {
  color-scheme: light;
  --primary: #7c73ff;
  --primary-dark: #5a52d5;
  --primary-light: #9d97ff;
  --secondary: #ff7a94;
  --accent: #43e97b;
  --bg: #f0f2f6;
  --bg-light: #fafafc;
  --bg-card: #fafafc;
  --surface: #f0f2f8;
  --text: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --info: #3b82f6;
  --shadow: 0 8px 32px rgba(0,0,0,0.07);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 40px rgba(124,115,255,0.08);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-smooth: 0.3s ease;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-base: 15px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 22px;
  --fs-3xl: 24px;
  --fs-4xl: 26px;
  --fs-5xl: 28px;
  --panel-bg: var(--bg-card);
  --panel-border-color: var(--border);
  --header-height: 56px;
  --left-panel-width: 336px;
  --right-panel-width: 300px;
  --radius-btn: 10px;
  --shadow-header: 0 1px 6px rgba(0,0,0,0.06);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.04);
  --text-primary: #1a1a2e;
  --hover-bg: rgba(0,0,0,0.04);
  --surface2: #eef0f6;
  --bg-hover: rgba(0,0,0,0.04);
  --input-bg: #f5f6fa;
}

[data-ui-scale="minimal"] {
  --fs-xs: 10px;
  --fs-sm: 11px;
  --fs-md: 12px;
  --fs-base: 13px;
  --fs-lg: 14px;
  --fs-xl: 16px;
  --fs-2xl: 18px;
  --fs-3xl: 20px;
  --fs-4xl: 22px;
  --fs-5xl: 24px;
  --panel-bg: var(--bg);
  --panel-border-color: var(--border);
}

html {
  transition: background 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] {
  color-scheme: dark;
  --primary: #7c73ff;
  --primary-dark: #5a52d5;
  --primary-light: #9d97ff;
  --secondary: #ff7a94;
  --accent: #4ff58a;
  --bg: #0b0b14;
  --bg-light: #14141f;
  --bg-card: #14141f;
  --surface: #1a1a2e;
  --text: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b85;
  --border: #2a2a45;
  --border-light: #22223a;
  --danger: #f87171;
  --warning: #fbbf24;
  --success: #34d399;
  --info: #60a5fa;
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.2);
  --shadow-glow: 0 0 40px rgba(124,115,255,0.15);
  --shadow-header: 0 1px 6px rgba(0,0,0,0.2);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.15);
  --text-primary: #e8e8f0;
  --hover-bg: rgba(255,255,255,0.06);
  --surface2: #1e1e36;
  --bg-hover: rgba(255,255,255,0.06);
  --input-bg: #0f0f1a;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-secondary);
  background: var(--hover-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); background: var(--surface); }
[data-theme="dark"] ::selection { color: #fff; background: rgba(124,115,255,.55); }
::selection { color: var(--text); background: rgba(124,115,255,.25); }

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
  color: var(--text);
  font-size: var(--fs-lg);
  transition: var(--transition);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input, select, textarea {
  font-family: var(--font);
  font-size: var(--fs-lg);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  outline: none;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
}

input[type="color"] {
  width: 40px;
  height: 40px;
  padding: 3px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  border: none;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 0 12px rgba(108,99,255,0.25);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 12px rgba(108,99,255,0.25);
}

select {
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* hoverは疑似クラスではなくJS等で代替 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: var(--fs-lg);
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.btn:hover::after {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 16px rgba(108,99,255,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(108,99,255,0.4);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #e84142);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255,71,87,0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(255,71,87,0.4);
}

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

.btn-ghost:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text);
}

[data-theme="dark"] .btn-ghost:hover {
  background: rgba(255,255,255,0.06);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--fs-md);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.label {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.value {
  font-size: var(--fs-base);
  color: var(--text);
}

.flex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gap-sm { gap: 4px; }
.gap-md { gap: 8px; }
.gap-lg { gap: 16px; }

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

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: var(--fs-3xl);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-3xl);
  color: var(--text-secondary);
}

.modal-close:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

[data-theme="dark"] .modal-close:hover {
  background: rgba(255,255,255,0.08);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  border: 1px solid var(--border);
}

.tooltip:hover::after {
  opacity: 1;
}

/* ─── アニメーション ─── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes floatGlow {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 8px 32px rgba(0,0,0,0.06);
  }
  50% {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(108,99,255,0.1);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes gradientSweep {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes shimmerCard {
  0% {
    border-color: var(--border);
    box-shadow: var(--shadow);
  }
  50% {
    border-color: rgba(108,99,255,0.3);
    box-shadow: 0 8px 40px rgba(108,99,255,0.08);
  }
  100% {
    border-color: var(--border);
    box-shadow: var(--shadow);
  }
}

/* アニメーションユーティリティ */
.anim-fade-in {
  animation: fadeIn 0.5s ease both;
}

.anim-fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.anim-fade-in-down {
  animation: fadeInDown 0.5s ease both;
}

.anim-scale-in {
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.anim-float {
  animation: float 3s ease-in-out infinite;
}

.anim-float-glow {
  animation: floatGlow 4s ease-in-out infinite;
}

.anim-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.anim-shimmer {
  background: linear-gradient(90deg,
    var(--bg-card) 0%,
    rgba(108,99,255,0.05) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2.5s ease-in-out infinite;
}

/* 遅延アニメーションユーティリティ */
.delay-1  { animation-delay: 0.1s; }
.delay-2  { animation-delay: 0.2s; }
.delay-3  { animation-delay: 0.3s; }
.delay-4  { animation-delay: 0.4s; }
.delay-5  { animation-delay: 0.5s; }
.delay-6  { animation-delay: 0.6s; }
.delay-7  { animation-delay: 0.7s; }
.delay-8  { animation-delay: 0.8s; }

/* グラスモーフィズム */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.8);
}

[data-theme="dark"] .glass {
  background: rgba(15, 15, 26, 0.7);
  border: 1px solid rgba(255,255,255,0.08);
}

.glass-light {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.6);
}

[data-theme="dark"] .glass-light {
  background: rgba(15, 15, 26, 0.5);
  border: 1px solid rgba(255,255,255,0.06);
}

/* グロー効果 */
.glow-primary {
  box-shadow: 0 0 30px rgba(108,99,255,0.15);
}

.glow-secondary {
  box-shadow: 0 0 30px rgba(255,101,132,0.15);
}

/* ホバーリフト */
.hover-lift {
  transition: var(--transition);
}

.hover-lift:hover {
  transform: translateY(-3px);
}

.hover-glow:hover {
  box-shadow: 0 8px 32px rgba(108,99,255,0.15);
}

/* ─── Material Icons ─── */
.icon {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.tab-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg, var(--bg));
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.tab-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(108,99,255,0.15);
}

.security-modal-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg, var(--bg));
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.security-modal-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(108,99,255,0.15);
}

.icon-fill {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.icon-sm { font-size: 18px; }
.icon-lg { font-size: 26px; }
.icon-xl { font-size: 32px; }
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  src: url('../assets/fonts/MaterialSymbolsOutlined.woff2') format('woff2');
}
.preflight-modal{max-width:680px}.preflight-summary{display:flex;gap:12px;padding:12px 20px;border-bottom:1px solid var(--border);font-size:13px}.preflight-summary strong{color:var(--danger)}.preflight-list{display:grid;gap:8px;max-height:min(54vh,520px);overflow:auto;padding:16px 20px}.preflight-item{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:12px;width:100%;padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);text-align:left;cursor:pointer}.preflight-item:hover{border-color:var(--primary)}.preflight-item.error>.icon:first-child{color:var(--danger)}.preflight-item.warning>.icon:first-child{color:#d89500}.preflight-item strong,.preflight-item small{display:block}.preflight-item small{margin-top:3px;color:var(--text-secondary)}
.responsive-preset-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:20px}.responsive-preset-list label{display:flex;align-items:center;gap:10px;padding:12px;border:1px solid var(--border);border-radius:10px;cursor:pointer}.responsive-preset-list label:has(input:checked){border-color:var(--primary);background:color-mix(in srgb,var(--primary) 8%,transparent)}.responsive-preset-list strong,.responsive-preset-list small{display:block}.responsive-preset-list small{margin-top:3px;color:var(--text-secondary)}.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}@media(max-width:560px){.responsive-preset-list{grid-template-columns:1fr}}
