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

:root{
  --bg-top:#071126;
  --bg-bottom:#0d1f49;
  --card-bg:rgba(255,255,255,.06);
  --card-border:rgba(255,255,255,.08);
  --text:#ffffff;
  --muted:rgba(255,255,255,.84);
  --accent1:#5ea0ff;
  --accent2:#5b7cff;
  --soft:rgba(94,160,255,.14);
  --soft-border:rgba(94,160,255,.25);
  --danger:#ff7a7a;
  --success:#7fffb2;
}

body.theme-bronz{
  --accent1:#b98048;
  --accent2:#8a5d32;
  --soft:rgba(185,128,72,.18);
  --soft-border:rgba(185,128,72,.30);
}

body.theme-gumus{
  --accent1:#c7d0db;
  --accent2:#8c98a8;
  --soft:rgba(199,208,219,.18);
  --soft-border:rgba(199,208,219,.32);
}

body.theme-altin{
  --accent1:#e2c15d;
  --accent2:#b98a22;
  --soft:rgba(226,193,93,.18);
  --soft-border:rgba(226,193,93,.30);
}

body.theme-pro{
  --accent1:#5ea0ff;
  --accent2:#5b7cff;
  --soft:rgba(94,160,255,.18);
  --soft-border:rgba(94,160,255,.30);
}

body.theme-mor{
  --accent1:#bb86ff;
  --accent2:#7b49d7;
  --soft:rgba(187,134,255,.18);
  --soft-border:rgba(187,134,255,.30);
}

html,body{
  margin:0;
  padding:0;
}

body{
  font-family:Arial,Helvetica,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at top, rgba(94,160,255,.10) 0%, transparent 35%),
    linear-gradient(180deg,var(--bg-top) 0%,var(--bg-bottom) 100%);
  min-height:100vh;
  overflow-x:hidden;
  padding:24px;
}

a{
  color:inherit;
  text-decoration:none;
}

.wrap{
  width:100%;
  max-width:1280px;
  margin:0 auto;
  position:relative;
  z-index:2;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:22px;
  flex-wrap:wrap;
}

.topbar h1{
  margin:0;
  font-size:30px;
  font-weight:800;
  letter-spacing:.04em;
}

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

.layout{
  display:grid;
  grid-template-columns:380px 1fr;
  gap:20px;
  align-items:start;
}

.left-col,
.right-col{
  display:grid;
  gap:20px;
}

.card{
  background:var(--card-bg);
  border:1px solid var(--card-border);
  border-radius:24px;
  padding:22px;
  box-shadow:0 20px 50px rgba(0,0,0,.20);
  backdrop-filter:blur(10px);
  position:relative;
  overflow:hidden;
}

.card::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:linear-gradient(180deg,rgba(255,255,255,.03),transparent 30%);
}

.card h2{
  font-size:22px;
  margin-bottom:16px;
  position:relative;
  z-index:1;
}

.section-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:14px;
  flex-wrap:wrap;
  position:relative;
  z-index:1;
}

.form-group{
  margin-bottom:14px;
  position:relative;
  z-index:1;
}

label,
.label{
  display:block;
  margin-bottom:8px;
  font-size:14px;
  color:var(--muted);
  font-weight:700;
}

input[type="text"],
input[type="password"],
textarea,
select{
  width:100%;
  border:none;
  outline:none;
  border-radius:14px;
  background:#fff;
  color:#111827;
  padding:14px;
  font-size:15px;
}

textarea{
  min-height:120px;
  resize:vertical;
}

input[type="checkbox"]{
  transform:scale(1.05);
}

.checks{
  display:grid;
  gap:10px;
  margin-top:10px;
  margin-bottom:16px;
  position:relative;
  z-index:1;
}

.check-line,
.check-row{
  display:flex;
  align-items:flex-start;
  gap:10px;
  font-size:14px;
  color:rgba(255,255,255,.85);
}

.check-box{
  background:rgba(79,111,208,.20);
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  padding:18px;
  margin:10px 0 16px;
}

.info-box{
  margin-top:12px;
  font-size:14px;
  line-height:1.6;
  color:rgba(255,255,255,.78);
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  padding:14px 16px;
}

#panelMessage,
.message{
  min-height:22px;
  margin-top:10px;
  font-size:14px;
  font-weight:700;
  color:#dbe5ff;
  position:relative;
  z-index:1;
}

.btn,
.save-btn,
.engine-btn,
.logout-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:none;
  border-radius:14px;
  color:#fff;
  cursor:pointer;
  font-weight:800;
  transition:.18s ease;
}

.btn:hover,
.save-btn:hover,
.engine-btn:hover,
.logout-btn:hover{
  transform:translateY(-1px);
}

.btn-primary,
.btn,
.save-btn,
.engine-btn{
  background:linear-gradient(135deg,var(--accent1),var(--accent2));
  color:#fff;
  box-shadow:0 0 24px rgba(0,0,0,.16);
}

.btn-secondary{
  background:rgba(255,255,255,.08);
  color:#fff;
  border:1px solid rgba(255,255,255,.08);
}

.btn-danger,
.logout-btn,
.actions .danger{
  background:rgba(255,122,122,.14);
  color:#fff;
  border:1px solid rgba(255,122,122,.28);
}

.btn{
  min-height:46px;
  padding:0 18px;
  font-size:15px;
}

.save-btn{
  width:100%;
  display:block;
  padding:16px 18px;
  margin-top:18px;
  border-radius:14px;
  font-size:18px;
  min-height:56px;
}

.save-btn:active{
  transform:scale(.98);
}

.logout-btn{
  padding:12px 18px;
  font-size:15px;
}

.engine-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.engine-top h3{
  margin:0;
  font-size:24px;
  font-weight:800;
}

#engineStatus,
.engine-status{
  margin-bottom:12px;
  color:#dbe5ff;
  font-size:14px;
  font-weight:700;
  position:relative;
  z-index:1;
}

.engine-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:12px;
  margin-bottom:14px;
  position:relative;
  z-index:1;
}

.engine-card{
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.07);
  border-radius:18px;
  padding:14px;
  box-shadow:0 10px 24px rgba(0,0,0,.12);
}

.engine-card-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:6px;
}

.engine-card strong{
  font-size:15px;
}

.engine-badge{
  padding:4px 10px;
  border-radius:999px;
  background:var(--soft);
  border:1px solid var(--soft-border);
  font-size:12px;
  font-weight:700;
  color:#eef4ff;
}

.engine-line{
  font-size:14px;
  color:rgba(255,255,255,.86);
  line-height:1.6;
  margin-bottom:6px;
}

#engineNarrative,
.narrative-box{
  color:rgba(255,255,255,.78);
  line-height:1.7;
  margin-top:8px;
  white-space:pre-wrap;
  position:relative;
  z-index:1;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  padding:18px;
  min-height:120px;
}

#memoriesList{
  display:grid;
  gap:14px;
  position:relative;
  z-index:1;
}

.memory-item{
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.07);
  border-radius:20px;
  padding:18px;
  box-shadow:0 10px 30px rgba(0,0,0,.14);
}

.memory-item h3{
  margin-bottom:10px;
  font-size:20px;
  font-weight:800;
}

.memory-item p{
  margin:8px 0;
  line-height:1.6;
  color:rgba(255,255,255,.86);
  word-break:break-word;
}

.memory-meta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:10px 0 2px;
}

.meta-pill{
  padding:6px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
  font-size:12px;
  color:#eef4ff;
}

.actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
}

.actions a,
.actions button{
  min-height:42px;
  padding:0 14px;
  border:none;
  border-radius:12px;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg,var(--accent1),var(--accent2));
  color:#fff;
  border:1px solid rgba(255,255,255,.08);
}

.actions button.secondary-action{
  background:rgba(255,255,255,.08);
}

.actions button:disabled{
  opacity:.55;
  cursor:not-allowed;
}

/* Hologram Stage */
#hologram-display{
  position:relative;
  background:radial-gradient(circle at center, #1a1a2e 0%, #000000 100%);
  overflow:hidden;
  transition:background 2s ease-in-out;
  border-radius:24px;
  min-height:380px;
  padding:22px;
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 20px 50px rgba(0,0,0,.22);
  isolation:isolate;
}

#hologram-display.deep-memory{
  background:radial-gradient(circle at center, #2c1a05 0%, #000000 100%);
}

.particles{
  position:absolute;
  inset:0;
  background-image:
    radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
    radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px);
  background-size:550px 550px, 350px 350px;
  background-position:0 0, 40px 60px;
  animation:stars 60s linear infinite;
  opacity:.26;
  pointer-events:none;
  z-index:0;
}

@keyframes stars{
  from{transform:translateY(0)}
  to{transform:translateY(-550px)}
}

.stage-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
  position:relative;
  z-index:2;
  flex-wrap:wrap;
}

.stage-title{
  font-size:22px;
  font-weight:700;
  letter-spacing:.03em;
}

.stage-tools{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.tool-pill{
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.10);
  border-radius:999px;
  padding:8px 12px;
  font-size:12px;
  color:#fff;
}

#orchestrator-status,
.hologram-text-layer,
.hologram-meta-layer,
.hologram-audio-bar{
  position:relative;
  z-index:2;
}

#orchestrator-status{
  font-weight:700;
  margin-bottom:12px;
  color:#f3f7ff;
  min-height:22px;
}

.hologram-brand{
  position:absolute;
  inset:0;
  z-index:4;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.88);
  transition:opacity 1.2s ease, visibility 1.2s ease;
}

.hologram-brand.hide{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
}

.glitch-text{
  font-family:Arial,Helvetica,sans-serif;
  font-weight:200;
  letter-spacing:.5em;
  color:white;
  font-size:clamp(2rem,5vw,3.3rem);
  position:relative;
  text-transform:uppercase;
}

.glitch-text::before,
.glitch-text::after{
  content:attr(data-text);
  position:absolute;
  inset:0;
  pointer-events:none;
}

.init-glitch{
  animation:glitch-anim .42s cubic-bezier(.25,.46,.45,.94) both;
}

@keyframes glitch-anim{
  0%{transform:translate(0);text-shadow:-2px 0 red,2px 0 blue;}
  25%{transform:translate(-2px,2px);text-shadow:2px 0 red,-2px 0 blue;}
  50%{transform:translate(2px,-2px);text-shadow:-2px 0 red,2px 0 blue;}
  100%{transform:translate(0);text-shadow:none;}
}

.hologram-text-layer{
  margin-top:14px;
  line-height:1.8;
  white-space:pre-wrap;
  min-height:110px;
  color:#ffffff;
  font-size:16px;
}

.hologram-meta-layer{
  margin-top:14px;
  font-size:13px;
  opacity:.82;
  line-height:1.7;
  color:#e6eeff;
}

.hologram-audio-bar{
  margin-top:18px;
  display:none;
}

.hologram-audio-controls{
  display:flex;
  gap:14px;
  align-items:center;
  flex-wrap:wrap;
}

#play-memory-audio{
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.08);
  color:white;
  padding:10px 14px;
  border-radius:12px;
  cursor:pointer;
  backdrop-filter:blur(8px);
  font-weight:700;
}

#play-memory-audio:hover{
  background:rgba(255,255,255,.14);
}

.audio-toggle{
  font-size:13px;
  opacity:.92;
  display:inline-flex;
  align-items:center;
  gap:8px;
}

.flicker-animation{
  animation:flicker 1.8s ease-in-out;
}

@keyframes flicker{
  0%{opacity:.2;transform:translateY(4px)}
  25%{opacity:1}
  50%{opacity:.75}
  100%{opacity:1;transform:translateY(0)}
}

/* Vault Lock */
#hologram-vault-lock{
  position:absolute;
  inset:0;
  z-index:5;
  background:rgba(0,0,0,.85);
  backdrop-filter:blur(12px);
  display:none;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:white;
  border-radius:24px;
  padding:20px;
}

.lock-overlay{
  max-width:320px;
  width:100%;
}

.lock-icon{
  font-size:34px;
  margin-bottom:16px;
}

#lock-message{
  font-family:Georgia,serif;
  font-style:italic;
  font-size:1.05rem;
  margin-bottom:24px;
  line-height:1.6;
  opacity:.92;
  min-height:52px;
}

.pin-input-container{
  display:grid;
  gap:12px;
}

.pin-input-container input{
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.2);
  color:white;
  padding:12px;
  border-radius:12px;
  width:100%;
  text-align:center;
  font-size:1.2rem;
  letter-spacing:6px;
  margin-bottom:2px;
}

#unlock-btn{
  display:block;
  width:100%;
  background:white;
  color:black;
  border:none;
  padding:12px;
  border-radius:10px;
  font-weight:700;
  cursor:pointer;
  transition:transform .2s;
  min-height:46px;
}

#unlock-btn:active{
  transform:scale(.97);
}

.lock-hint{
  margin-top:12px;
  font-size:13px;
  opacity:.76;
}

@keyframes shake{
  0%,100%{transform:translateX(0)}
  25%{transform:translateX(-4px)}
  75%{transform:translateX(4px)}
}

.shake-animation{
  animation:shake .4s cubic-bezier(.36,.07,.19,.97) both;
}

/* Modal */
.modal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.64);
  z-index:9999;
  justify-content:center;
  align-items:center;
  padding:20px;
}

.modal-box{
  width:min(560px,100%);
  background:#0d1738;
  border:1px solid rgba(255,255,255,.08);
  border-radius:24px;
  padding:24px;
  box-shadow:0 20px 60px rgba(0,0,0,.35);
}

.modal-box h3{
  margin:0 0 14px;
  font-size:22px;
  font-weight:800;
}

.modal-box p,
.modal-text{
  line-height:1.7;
  color:rgba(255,255,255,.84);
  word-break:break-word;
}

#qrSlugText{
  font-size:14px;
  font-weight:700;
  word-break:break-word;
  margin-bottom:14px;
}

#qrCanvasWrap{
  display:flex;
  justify-content:center;
  align-items:center;
  margin:16px 0 20px;
  padding:24px;
  background:#ffffff;
  border-radius:16px;
  min-height:160px;
  color:#111827;
}

.modal-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
}

.modal-actions button{
  border:none;
  border-radius:12px;
  background:linear-gradient(135deg,var(--accent1),var(--accent2));
  color:#fff;
  padding:11px 15px;
  cursor:pointer;
  font-size:14px;
  font-weight:700;
}

.page-footer{
  text-align:center;
  padding:18px;
  color:rgba(255,255,255,.72);
}

@media (max-width:1040px){
  .layout{
    grid-template-columns:1fr;
  }

  .engine-grid{
    grid-template-columns:repeat(2,1fr);
  }
}

@media (max-width:700px){
  body{
    padding:16px;
  }

  .topbar{
    gap:12px;
  }

  .topbar h1{
    font-size:24px;
  }

  .section-title{
    font-size:24px;
  }

  .engine-grid{
    grid-template-columns:1fr;
  }

  .hologram-text-layer{
    font-size:15px;
  }

  .glitch-text{
    letter-spacing:.25em;
  }
}