/* ===== KARİYER MERDİVENİ — piksel arayüz ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #1a1c2c;
  --bg2: #24273d;
  --panel: #2b2f4a;
  --panel-dark: #20233a;
  --border: #10121f;
  --text: #f0ead2;
  --accent: #ffd452;
  --accent2: #6cbf5a;
  --danger: #e05656;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
  min-height: 100vh;
}

body {
  background-image:
    radial-gradient(circle at 20% 10%, rgba(108,120,220,.08), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(108,191,90,.06), transparent 40%);
}

#wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

.panel {
  background: var(--panel);
  border: 4px solid var(--border);
  box-shadow: 0 6px 0 rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.06);
  border-radius: 4px;
}

/* ===== butonlar ===== */
.btn {
  font-family: inherit;
  font-weight: bold;
  font-size: 15px;
  color: var(--text);
  background: #3d4266;
  border: 3px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 0 var(--border);
  padding: 8px 16px;
  cursor: pointer;
  transition: transform .05s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--border); }
.btn.big { font-size: 19px; padding: 12px 28px; }
.btn.tiny { font-size: 13px; padding: 3px 9px; box-shadow: 0 3px 0 var(--border); }
.btn.ghost { background: var(--panel-dark); }
.btn.start { background: #2e7d32; margin-top: 18px; }
.btn.start:hover { background: #349439; }

/* ===== menü ===== */
#menu { width: 100%; text-align: center; padding: 12px 0 30px; }

.game-title {
  font-size: 34px;
  letter-spacing: 3px;
  color: var(--accent);
  text-shadow: 3px 3px 0 #7a4a1d, 6px 6px 0 rgba(0,0,0,.4);
  margin: 10px 0 4px;
}
.tagline { color: #aab; margin-bottom: 18px; font-size: 14px; }
.menu-hint { color: #778; font-size: 12px; margin-top: 14px; }

#continuePanel { margin-bottom: 20px; }
#continuePanel p { margin-bottom: 10px; color: var(--accent); }
.btn-row { display: flex; gap: 12px; justify-content: center; }

#creator {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  text-align: left;
}
.creator-left { width: 330px; padding: 14px; }
.creator-right { flex: 1; min-width: 380px; max-width: 560px; padding: 14px; }
.creator-left h3, .creator-right h3 {
  text-align: center; color: var(--accent);
  letter-spacing: 2px; margin-bottom: 10px; font-size: 16px;
}

#previewCanvas {
  display: block;
  margin: 0 auto 10px;
  background: var(--panel-dark);
  border: 3px solid var(--border);
  border-radius: 4px;
}

.opt-row { margin-bottom: 9px; }
.opt-row > label {
  display: block; font-size: 12px; color: #9aa;
  letter-spacing: 1px; text-transform: uppercase; margin-bottom: 3px;
}
.name-box { display: flex; gap: 6px; }
#nameInput {
  flex: 1;
  font-family: inherit; font-weight: bold; font-size: 15px;
  background: var(--panel-dark); color: var(--text);
  border: 3px solid var(--border); border-radius: 4px;
  padding: 6px 8px; outline: none;
}
#nameInput:focus { border-color: var(--accent); }

.step-box { display: flex; align-items: center; gap: 8px; }
.step-val { flex: 1; text-align: center; background: var(--panel-dark);
  border: 2px solid var(--border); border-radius: 3px; padding: 4px; font-size: 14px; }

.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
  width: 26px; height: 26px;
  border: 3px solid var(--border); border-radius: 4px;
  cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,.4);
}
.swatch.sel { border-color: var(--accent); transform: scale(1.12); }

/* meslek kartları */
#profCards { display: flex; flex-direction: column; gap: 8px; }
.prof-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--panel-dark);
  border: 3px solid var(--border); border-radius: 4px;
  padding: 9px 12px; cursor: pointer;
  transition: transform .06s;
}
.prof-card:hover { transform: translateX(4px); border-color: #556; }
.prof-card.sel { border-color: var(--accent); background: #3a3417; }
.prof-icon { font-size: 30px; width: 44px; text-align: center; }
.prof-info b { display: block; font-size: 16px; color: var(--text); }
.prof-info .prof-desc { font-size: 12px; color: #9aa; display: block; }
.prof-info .prof-ladder { font-size: 11px; color: #cba135; display: block; margin-top: 2px; }

/* ===== oyun ekranı ===== */
#game { width: 100%; display: flex; flex-direction: column; align-items: center; position: relative; }

#gameCanvas {
  border: 4px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 8px 0 rgba(0,0,0,.4);
  background: #000;
  max-width: 100%;
}

#hud {
  width: 100%; max-width: 960px;
  display: flex; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
#hudChar { padding: 8px 14px; min-width: 230px; }
#hudName { color: var(--accent); font-size: 16px; }
#hudRank { font-size: 13px; color: #bcd; }
#hudTaskCount { font-size: 11px; color: #889; margin-top: 2px; }
#rankBar {
  height: 10px; background: var(--panel-dark);
  border: 2px solid var(--border); border-radius: 3px;
  margin-top: 4px; overflow: hidden;
}
#rankFill { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #6cbf5a, #ffd452); transition: width .4s; }

#hudTask { flex: 1; padding: 8px 14px; }
.hud-task-label { font-size: 10px; color: var(--accent); letter-spacing: 2px; }
#taskTitle { display: block; font-size: 15px; }
#taskDesc { display: block; font-size: 12px; color: #aab; }

#controls { margin-top: 8px; font-size: 12px; color: #778; }

/* HUD araç butonları (fare ile panel açma) */
#hudTools { display: flex; gap: 5px; margin-top: 6px; }
#hudTools button {
  font-size: 15px; line-height: 1;
  width: 30px; height: 26px;
  background: var(--panel-dark);
  border: 2px solid var(--border); border-radius: 4px;
  box-shadow: 0 2px 0 var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#hudTools button:hover { filter: brightness(1.3); }
#hudTools button:active { transform: translateY(2px); box-shadow: none; }
body.touch #hudTools { display: none; }

/* diyalog kutusu */
#dialog {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: 60px;
  width: 640px; max-width: 92%;
  background: rgba(16,18,31,.94);
  border: 4px solid #454b70;
  border-radius: 6px;
  padding: 12px 18px 24px;
  z-index: 20;
}
#dlgName { color: var(--accent); font-size: 14px; margin-bottom: 4px; }
#dlgText { font-size: 15px; line-height: 1.45; min-height: 44px; }
#dlgHint { position: absolute; right: 12px; bottom: 6px; font-size: 11px; color: #667; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* modallar */
.modal {
  position: absolute; inset: 0;
  background: rgba(10,12,20,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 30;
}
.modal-box { padding: 22px 28px; text-align: center; max-width: 480px; position: relative; overflow: hidden; }
.modal-box h3 { color: var(--accent); margin-bottom: 8px; letter-spacing: 1px; }
.modal-box p { font-size: 14px; margin-bottom: 10px; }
#mgCanvas { background: var(--panel-dark); border: 3px solid var(--border); border-radius: 4px; }
#mgStatus { margin-top: 8px; min-height: 20px; color: var(--accent2); }

#quizChoices { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
#quizChoices .btn { text-align: left; }
#quizFeedback { min-height: 20px; color: var(--accent); font-size: 13px; }

/* terfi & final */
.promo-box { min-width: 380px; }
.promo-box h2 { color: var(--accent); font-size: 26px; margin-bottom: 14px; text-shadow: 2px 2px 0 rgba(0,0,0,.5); }
.promo-old { color: #99a; text-decoration: line-through; font-size: 15px; }
.promo-arrow { font-size: 22px; margin: 4px 0; }
.promo-new { color: var(--accent2); font-size: 20px; text-shadow: 2px 2px 0 rgba(0,0,0,.5); margin-bottom: 14px; }
.end-note { color: #aab; font-size: 13px; line-height: 1.5; }
#endStats { color: #bcd; font-size: 13px; }

#confetti, #confetti2 { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.conf {
  position: absolute; top: -12px;
  width: 8px; height: 8px;
  animation: confFall linear forwards;
}
@keyframes confFall {
  to { transform: translateY(420px) rotate(720deg); opacity: 0; }
}

/* bildirim */
#toast {
  position: absolute;
  top: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(16,18,31,.95);
  border: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  padding: 10px 22px;
  font-size: 15px;
  z-index: 40;
  animation: toastPop .25s;
}
@keyframes toastPop { from { transform: translateX(-50%) scale(.7); opacity: 0; } }

/* ===== para & yan görev HUD ===== */
#hudMoney { font-size: 13px; color: var(--accent); margin-top: 2px; }
#hudSide { display: block; font-size: 12px; color: #f0a8ff; margin-top: 3px; }
#profileLine { font-size: 12px; color: #cba135; margin-bottom: 12px; min-height: 14px; }
#endCareers { color: var(--accent); font-size: 14px; margin-bottom: 8px; }

/* ===== dükkan ===== */
.shop-box { min-width: 420px; }
#shopMoney { color: var(--accent); font-size: 15px; }
#shopItems { max-height: 330px; overflow-y: auto; margin: 10px 0; }
.shop-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-dark);
  border: 2px solid var(--border); border-radius: 4px;
  padding: 8px 10px; margin-bottom: 8px; text-align: left;
}
.shop-item .si-icon { font-size: 24px; width: 34px; text-align: center; }
.shop-item .si-info { flex: 1; }
.shop-item .si-info b { display: block; font-size: 14px; }
.shop-item .si-info span { font-size: 11px; color: #9aa; }
.shop-item .btn { min-width: 86px; font-size: 13px; }
.shop-item .btn.owned { background: #2e5d33; cursor: default; }

/* ===== başarımlar ===== */
.achv-box { min-width: 460px; }
#achList {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; max-height: 340px; overflow-y: auto; margin: 10px 0;
}
.ach-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-dark);
  border: 2px solid var(--border); border-radius: 4px;
  padding: 7px 9px; text-align: left;
}
.ach-item .ai-icon { font-size: 20px; width: 28px; text-align: center; }
.ach-item b { display: block; font-size: 12px; }
.ach-item span { font-size: 10px; color: #9aa; }
.ach-item.locked { opacity: .4; filter: grayscale(.9); }
.ach-item.unlocked { border-color: #6b5a1e; }

/* ===== kişiler / dostluk ===== */
#peopleGifts { color: var(--accent); font-size: 13px; }
#peopleList {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; max-height: 340px; overflow-y: auto; margin: 10px 0;
}
.person-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-dark);
  border: 2px solid var(--border); border-radius: 4px;
  padding: 7px 9px; text-align: left;
}
.person-item b { display: block; font-size: 12px; }
.person-item span { font-size: 10px; color: #e88aa0; }
.person-item .p-level { color: #9aa; }

/* ===== gardırop ===== */
#wardrobeMoney { color: var(--accent); font-size: 14px; }
#wardrobeItems { max-height: 340px; overflow-y: auto; margin: 10px 0; }
.wr-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-dark);
  border: 2px solid var(--border); border-radius: 4px;
  padding: 8px 10px; margin-bottom: 8px; text-align: left;
}
.wr-item .wr-icon { font-size: 24px; width: 34px; text-align: center; }
.wr-item .wr-info { flex: 1; }
.wr-item .wr-info b { display: block; font-size: 14px; }
.wr-item .wr-info span { font-size: 11px; color: #9aa; }
.wr-item .btn { min-width: 92px; font-size: 13px; }
.wr-item .btn.equipped { background: #2e5d33; }
.wr-item .btn.locked { background: #3a2a2a; cursor: default; opacity: .7; }

/* ===== plaza etkinlik banner ===== */
#plazaBanner {
  position: absolute;
  top: 40px; left: 50%; transform: translateX(-50%);
  background: rgba(16,18,31,.96);
  border: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 26px; text-align: center;
  z-index: 45;
  animation: pbPop .4s;
  box-shadow: 0 0 24px rgba(255,212,82,.35);
}
#plazaBanner b { display: block; font-size: 20px; color: var(--accent); text-shadow: 2px 2px 0 rgba(0,0,0,.5); }
#plazaBanner span { font-size: 13px; color: var(--text); }
@keyframes pbPop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }

/* ===== dokunmatik kontroller ===== */
#touchControls {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 25;
}
body.touch.playing #touchControls { display: flex; }
body.touch #controls { display: none; }

#touchControls button {
  pointer-events: auto;
  font-family: inherit; font-weight: bold;
  color: var(--text);
  background: rgba(43, 47, 74, .78);
  border: 3px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 3px 0 rgba(0,0,0,.4);
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
#touchControls button:active { transform: translateY(2px); filter: brightness(1.4); }

.tc-dpad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 5px;
}
.tc-btn { font-size: 22px; }
.tc-up { grid-area: 1 / 2; }
.tc-left { grid-area: 2 / 1; }
.tc-right { grid-area: 2 / 3; }
.tc-down { grid-area: 3 / 2; }

.tc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.tc-utils { display: flex; gap: 6px; }
.tc-act-row { display: flex; align-items: center; gap: 12px; }
.tc-mini { width: 46px; height: 46px; font-size: 18px; border-radius: 10px; }
.tc-action {
  width: 84px; height: 84px;
  font-size: 26px;
  border-radius: 50%;
  background: rgba(46, 125, 50, .85) !important;
  border-width: 4px !important;
}
.tc-gift { background: rgba(122, 74, 29, .8); }

/* ===== responsive düzen ===== */
@media (max-width: 820px) {
  #wrap { padding: 8px; }
  .game-title { font-size: 24px; letter-spacing: 2px; }
  .tagline { font-size: 12px; }
  .creator-left, .creator-right { width: 100%; min-width: 0; }
  .shop-box, .achv-box { min-width: 0; width: 94%; }
  .promo-box { min-width: 0; width: 90%; }
  #mgCanvas { max-width: 100%; height: auto; }

  #hud { flex-direction: column; gap: 6px; margin-bottom: 6px; }
  #hudChar, #hudTask { width: 100%; min-width: 0; }
  #gameCanvas { width: 100%; height: auto; }
  #dialog { bottom: 130px; padding: 10px 14px 22px; }
  #dlgText { font-size: 14px; }
  .modal { align-items: flex-start; padding-top: 8vh; }
  .modal-box { max-height: 82vh; overflow-y: auto; }
}

/* dar ekranda HUD'u sıkıştır */
@media (max-width: 480px) {
  #hudName { font-size: 14px; }
  #hudRank, #taskTitle { font-size: 13px; }
  #taskDesc, #hudSide, #hudTaskCount, #hudMoney { font-size: 11px; }
  .tc-dpad { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(3, 50px); }
  .tc-action { width: 74px; height: 74px; }
}
