@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@300;400;500;600&display=swap');

:root {
  /* Cyber-Dark Palette & Glassmorphism */
  --bg: #0b0c10;
  --panel-bg: rgba(22, 24, 30, 0.4);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(0, 242, 255, 0.3);
  --accent: #00f2ff; /* Cyber Cyan */
  --accent-glow: 0 0 15px rgba(0, 242, 255, 0.4);
  --text-main: #f0f0f5;
  --text-muted: #9ba1a6;
  --radius: 12px;
  --font-sans: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 20% 0%, rgba(0, 242, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 100%, rgba(138, 43, 226, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
  font-weight: 300;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.glass {
  background: transparent;
  border-bottom: 1px solid var(--border-light);
}

header.glass {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 40px;
  background: rgba(11, 12, 16, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  margin: 0;
}

header h1 { 
  font-size: 1.6rem; 
  font-weight: 600; 
  letter-spacing: 0.05em;
  color: #fff;
  white-space: nowrap; /* Prevent squeezing/wrapping */
  margin-right: 20px;
}

.nav { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.nav-link {
  color: var(--text-muted); text-decoration: none; padding: 4px 8px;
  font-size: 0.85rem; transition: all .4s ease;
  position: relative;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.nav-link::after {
  content: ''; position: absolute; left: 50%; bottom: -4px;
  width: 0; height: 1px; background: var(--accent);
  transition: all .4s ease; transform: translateX(-50%);
}

.nav-link:hover { color: var(--accent); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-link.active { color: var(--text-main); }

main#app { 
  flex: 1;
  padding: 48px 24px; 
  width: 100%;
  max-width: 860px; 
  margin: 0 auto; 
}
main#app.wide-page { max-width: 1180px; }

.card {
  padding: 48px; margin-bottom: 32px;
  background: var(--panel-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

h2 {
  font-size: 2.2rem; font-weight: 600; margin-bottom: 8px;
  color: #fff; text-align: center; letter-spacing: 0.05em;
}
.card > p {
  text-align: center; margin-bottom: 40px; font-size: 1rem;
  color: var(--text-muted);
}

.input-group { margin-bottom: 28px; }
.input-group label { 
  display: block; font-size: 0.85rem; color: var(--text-muted); 
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 500;
}

.input-group input, .input-group textarea, .input-group select {
  width: 100%; padding: 14px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: 8px; 
  color: var(--text-main);
  font-size: 1rem; outline: none; transition: all .3s ease;
  font-family: var(--font-sans);
}
.input-group input:focus, .input-group textarea:focus, .input-group select:focus {
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
  background: rgba(0, 0, 0, 0.5);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 28px; 
  border: 1px solid var(--border-strong);
  background: rgba(0, 242, 255, 0.05);
  color: var(--accent); border-radius: 8px; cursor: pointer;
  font-size: 0.9rem; transition: all .3s ease;
  font-family: var(--font-sans); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-right: 12px; margin-bottom: 12px;
}
.btn:hover { 
  background: var(--accent);
  color: #000;
  box-shadow: var(--accent-glow);
}
.btn:active { transform: scale(0.96); }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.btn:disabled:hover {
  background: rgba(0, 242, 255, 0.05);
  color: var(--accent);
}

.output {
  margin-top: 32px; padding: 24px;
  background: rgba(0,0,0,0.5); border-radius: 8px;
  border: 1px solid var(--border-light);
  white-space: pre-wrap; word-break: break-all;
  font-family: var(--font-mono); 
  font-size: 0.95rem; color: #e0e0e0;
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.5);
}

.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px; margin-top: 40px;
}
.tool-card {
  padding: 32px 24px; border: 1px solid var(--border-light);
  border-radius: 16px; background: rgba(255,255,255,0.02);
  text-align: center; cursor: pointer; transition: all .4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.tool-card::before {
  content: ''; position: absolute; top:0; left:0; right:0; bottom:0;
  border-radius: 16px;
  border: 1px solid transparent; transition: all .4s;
  pointer-events: none;
}
.tool-card:hover { 
  transform: translateY(-8px) scale(1.02); 
  background: rgba(255,255,255,0.05);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), var(--accent-glow);
}
.tool-card:hover::before { border-color: rgba(0, 242, 255, 0.4); }
.tool-card .icon { font-size: 2.8rem; margin-bottom: 16px; transition: all .4s ease; }
.tool-card:hover .icon { transform: scale(1.1) translateY(-4px); filter: drop-shadow(0 0 10px rgba(0,242,255,0.6)); }
.tool-card .label { 
  font-size: 1.15rem; color: var(--text-main); font-weight: 500;
  letter-spacing: 0.05em;
}

.ideabox-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.4fr);
  gap: 24px;
  align-items: start;
}
.ideabox-panel,
.ideabox-preview {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  padding: 20px;
}
.ideabox-panel .input-group { margin-bottom: 18px; }
.ideabox-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.idea-document {
  background: #fff;
  color: #111;
  border-radius: 8px;
  padding: 28px;
  min-height: 620px;
  overflow: auto;
  font-family: "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.7;
}
.idea-document h3 {
  text-align: center;
  font-size: 1.45rem;
  margin-bottom: 18px;
}
.idea-document h4 {
  margin: 22px 0 10px;
  font-size: 1.05rem;
}
.idea-document h5 {
  margin: 16px 0 6px;
  font-size: 0.98rem;
}
.idea-document p { margin-bottom: 12px; }
.idea-document .idea-muted {
  color: #6b7280;
}
.idea-document .idea-warning {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.idea-document table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 18px;
  font-size: 0.92rem;
}
.idea-document th,
.idea-document td {
  border: 1px solid #222;
  padding: 8px;
  vertical-align: top;
  text-align: left;
}
.idea-document th {
  background: #f2f4f7;
  font-weight: 600;
}
.idea-empty {
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #64748b;
}

/* QR Code Canvas */
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; margin-top: 32px; }
.qr-wrap canvas, .qr-wrap img { border-radius: var(--radius); border: 1px solid var(--border-light); }
.qr-wrap img { background: #fff; padding: 12px; }

/* Color Picker */
.color-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.color-swatch {
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--border-strong); cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: transform .3s;
}
.color-swatch:hover { transform: scale(1.05); }

/* Diff */
.diff-line { display: flex; gap: 12px; align-items: center; margin: 8px 0; }
.diff-line .label { font-size: 0.8rem; padding: 4px 12px; border-radius: 6px; font-family: var(--font-mono); }
.diff-line .label.add { background: rgba(76, 175, 80, 0.2); color: #81c784; border: 1px solid rgba(76, 175, 80, 0.3); }
.diff-line .label.rem { background: rgba(244, 67, 54, 0.2); color: #e57373; border: 1px solid rgba(244, 67, 54, 0.3); }

/* Download */
.dropzone {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; color: var(--text-muted);
  transition: all .5s ease; margin-bottom: 24px;
}
.dropzone.dragover { border-color: var(--accent); background: rgba(197, 168, 128, 0.03); }

/* Footer */
footer { 
  text-align: center; padding: 40px 16px; 
  color: var(--text-muted); font-size: 0.8rem; 
  letter-spacing: 0.15em; 
  border-top: 1px solid var(--border-light); 
  font-family: var(--font-sans);
  text-transform: uppercase;
}

@media (max-width: 860px) {
  header.glass {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 18px 20px;
  }
  .ideabox-grid { grid-template-columns: 1fr; }
  .card { padding: 28px 20px; }
  .idea-document { padding: 18px; }
}
