/* ===== Okey Helper · Metin2Community ===== */

:root {
  --bg: #0b0d14;
  --bg-2: #11141f;
  --panel: rgba(22, 26, 40, 0.82);
  --panel-border: rgba(255, 255, 255, 0.07);
  --text: #eef0f6;
  --muted: #8b91a8;
  --gold: #f5c542;
  --gold-2: #d99a1e;
  --silver: #c9d1e0;
  --bronze: #c98a4b;
  --accent: #6d7cff;
  --danger: #ff5c7a;
  --ok: #4ade80;

  --card-r: #e0433f;
  --card-r-2: #9c1f1c;
  --card-b: #3f7fe0;
  --card-b-2: #1d3f8f;
  --card-y: #f2c230;
  --card-y-2: #a8780a;

  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Cinzel", "Inter", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* fundal */
.bg-glow {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(245, 197, 66, 0.14), transparent 60%),
    radial-gradient(800px 500px at 90% 10%, rgba(109, 124, 255, 0.14), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(224, 67, 63, 0.10), transparent 60%),
    var(--bg);
}
.fx-canvas {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  width: 100%; height: 100%;
}
body.no-fx .fx-canvas { display: none; }

/* ===== topbar ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(to bottom, rgba(11, 13, 20, 0.95), rgba(11, 13, 20, 0.7));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 46px; height: 46px; display: grid; place-items: center; filter: drop-shadow(0 0 10px rgba(90,170,255,0.45)); }
.brand-logo img { width: 46px; height: 46px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: 0.02em; white-space: nowrap; }
.brand-accent { color: var(--gold); }
.brand-sub { font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; }

/* ===== butoane ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 12px; border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.05); font-weight: 600; font-size: 15px;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease, box-shadow 0.2s ease;
  user-select: none;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,0.09); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-icon { padding: 10px; width: 42px; height: 42px; border-radius: 12px; }
.btn-small { padding: 8px 12px; font-size: 13px; }
.btn-ghost { background: transparent; }
.btn-primary { background: linear-gradient(135deg, #6d7cff, #4f5fe6); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(109,124,255,0.35); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #7c8aff, #5a6aee); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); border-color: transparent; color: #1a1300;
  box-shadow: 0 6px 18px rgba(245,197,66,0.35); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.06); }
.btn-discord { background: #5865f2; border-color: transparent; color: #fff; padding: 10px 14px; }
.btn-discord:hover { background: #6a75f5; }
.btn-settings { padding: 10px 14px; background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
.btn-settings:hover { background: rgba(255,255,255,0.11); }
.btn-settings svg { transition: transform 0.4s ease; }
.btn-settings:hover svg { transform: rotate(60deg); }
@media (max-width: 480px) {
  .btn-discord span, .btn-settings span { display: none; }
  .btn-discord, .btn-settings { width: 42px; padding: 10px; }
}

/* ===== layout ===== */
.layout {
  display: grid; gap: 16px; padding: 16px;
  max-width: 1180px; margin: 0 auto;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) 320px; padding: 24px; gap: 20px; }
  .side { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 20px; }
}
.play { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side { display: flex; flex-direction: column; gap: 16px; }

.card-panel {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.panel-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); font-weight: 600; margin-bottom: 12px;
}

/* ===== scorebar ===== */
.scorebar { display: flex; align-items: center; gap: 16px; }
.scorebar-left { display: flex; flex-direction: column; min-width: 90px; }
.scorebar-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.score { font-family: var(--font-display); font-size: 44px; font-weight: 800; line-height: 1; color: var(--gold);
  text-shadow: 0 0 24px rgba(245,197,66,0.35); font-variant-numeric: tabular-nums; }
.score.bump { animation: bump 0.45s cubic-bezier(.2,1.6,.4,1); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
body.no-fx .score.bump { animation: none; }
.scorebar-right { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chest-badge { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 13px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--panel-border); transition: all 0.3s; }
.chest-badge.chest-gold { color: var(--gold); border-color: rgba(245,197,66,0.4); background: rgba(245,197,66,0.1); box-shadow: 0 0 18px rgba(245,197,66,0.25); }
.chest-badge.chest-silver { color: var(--silver); border-color: rgba(201,209,224,0.4); background: rgba(201,209,224,0.08); }
.chest-badge.chest-bronze { color: var(--bronze); }
.progress-track { position: relative; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: visible; }
.progress-fill { height: 100%; border-radius: 999px; width: 0%;
  background: linear-gradient(90deg, var(--bronze), var(--silver) 70%, var(--gold));
  transition: width 0.6s cubic-bezier(.2,.8,.2,1); }
body.no-fx .progress-fill { transition: none; }
.progress-mark { position: absolute; top: -3px; width: 2px; height: 14px; background: rgba(255,255,255,0.35); border-radius: 2px; }
.progress-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px;
  font-variant-numeric: tabular-nums; }
.progress-labels span:nth-child(2) { margin-left: auto; margin-right: 6%; }
.score-next { font-size: 13px; color: var(--muted); min-height: 16px; }

/* ===== masa / carti ===== */
.board {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  margin-bottom: 14px;
}
@media (min-width: 520px) { .board { gap: 12px; } }

.slot {
  position: relative; aspect-ratio: 196 / 242; border-radius: 12px; border: 2px dashed rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02); display: grid; place-items: center; padding: 0;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: visible;
}
.slot-empty .slot-ph { font-size: 22px; color: rgba(255,255,255,0.18); font-weight: 700; }
.slot-awaiting { border-color: rgba(109,124,255,0.55); }
.slot-awaiting .slot-ph { color: rgba(109,124,255,0.8); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
body.no-fx .slot-awaiting .slot-ph { animation: none; }

.slot-filled { border: none; background: transparent; }
.slot-filled:hover { transform: translateY(-4px); }

.pcard {
  width: 100%; height: 100%; border-radius: 8px; position: relative; overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
  transform-style: preserve-3d; background: #111;
}
.pcard img { width: 100%; height: 100%; object-fit: cover; display: block; image-rendering: auto; user-select: none; -webkit-user-drag: none; }

.slot.deal .pcard { animation: deal 0.45s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes deal {
  0% { transform: translateY(-30px) rotateY(90deg) scale(0.8); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
body.no-fx .slot.deal .pcard { animation: none; }

.slot-picked .pcard { outline: 3px solid var(--gold); outline-offset: 1px; box-shadow: 0 0 0 6px rgba(245,197,66,0.15), 0 10px 24px rgba(245,197,66,0.35); }
.slot-picked { transform: translateY(-8px); }
.slot-picked::after {
  content: "✓"; position: absolute; top: -8px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold); color: #1a1300; font-size: 13px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4); z-index: 2;
}
.slot-suggested .pcard { box-shadow: 0 0 0 3px rgba(109,124,255,0.9), 0 0 24px rgba(109,124,255,0.55), 0 6px 16px rgba(0,0,0,0.45); }
.slot-suggested:not(.slot-picked)::before {
  content: ""; position: absolute; inset: -4px; border-radius: 16px; border: 2px solid rgba(109,124,255,0.8);
  animation: pulse 1.4s ease-in-out infinite; pointer-events: none;
}
.slot-suggested-discard .pcard { box-shadow: 0 0 0 3px rgba(255,92,122,0.9), 0 0 24px rgba(255,92,122,0.5), 0 6px 16px rgba(0,0,0,0.45); filter: saturate(0.8); }
.slot-suggested-discard::before {
  content: "✕"; position: absolute; top: -8px; left: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
@keyframes pulse { 0%, 100% { opacity: 0.35; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }
body.no-fx .slot-suggested::before { animation: none; opacity: 0.8; }

.slot.fly-out .pcard { animation: flyout 0.5s ease-in both; }
@keyframes flyout { to { transform: translateY(-60px) scale(0.6); opacity: 0; } }
.slot.shake { animation: shake 0.4s ease both; }
@keyframes shake { 20% { transform: translateX(-6px) rotate(-3deg); } 60% { transform: translateX(6px) rotate(3deg); } 100% { transform: none; } }
body.no-fx .slot.fly-out .pcard, body.no-fx .slot.shake { animation: none; }

/* plutitor +puncte */
.float-pts {
  position: fixed; z-index: 60; pointer-events: none; font-family: var(--font-display); font-weight: 800;
  font-size: 34px; color: var(--gold); text-shadow: 0 0 18px rgba(245,197,66,0.6), 0 2px 4px rgba(0,0,0,0.6);
  animation: floatup 1.1s ease-out forwards; transform: translate(-50%, -50%);
}
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -160%) scale(1); } }

/* ===== sugestie ===== */
.suggestion {
  border-radius: var(--radius-s); padding: 12px 14px; margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(109,124,255,0.14), rgba(109,124,255,0.04));
  border: 1px solid rgba(109,124,255,0.35); position: relative; overflow: hidden;
}
.suggestion.is-discard { background: linear-gradient(135deg, rgba(255,92,122,0.14), rgba(255,92,122,0.04)); border-color: rgba(255,92,122,0.35); }
.suggestion.is-waiting { background: rgba(255,255,255,0.03); border-color: var(--panel-border); }
.suggestion-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.suggestion-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.suggestion-status { font-size: 11px; color: var(--muted); }
.suggestion-status.pending::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px;
  border: 2px solid var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.suggestion-status.exact { color: var(--ok); }
.suggestion-text { font-size: 17px; font-weight: 600; line-height: 1.35; }
.suggestion-odds { font-size: 13px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.auto-bar { position: relative; height: 22px; margin-top: 10px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.auto-bar-fill { position: absolute; inset: 0; width: 0%; background: linear-gradient(90deg, var(--accent), #9aa5ff); }
.auto-bar-text { position: relative; display: block; text-align: center; font-size: 12px; font-weight: 600; line-height: 22px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions-secondary { grid-column: 1 / -1; display: flex; gap: 10px; }
.actions-secondary .btn { flex: 1; }
.pick-info { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 16px; text-align: center; }
.pick-info strong { color: var(--text); }

/* ===== paleta ===== */
.palette { display: flex; flex-direction: column; gap: 8px; }
.prow { display: grid; grid-template-columns: repeat(8, minmax(0, 64px)); gap: 6px; justify-content: center; }
@media (min-width: 520px) { .prow { gap: 10px; } }
.pc {
  aspect-ratio: 196 / 242; border-radius: 6px; border: none; padding: 0; position: relative; overflow: hidden;
  background: #111; box-shadow: 0 3px 8px rgba(0,0,0,0.45);
  transition: transform 0.12s, opacity 0.2s, filter 0.2s;
}
.pc img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.pc:hover:not(:disabled) { transform: translateY(-3px) scale(1.05); }
.pc:active:not(:disabled) { transform: scale(0.96); }
.pc.used { opacity: 0.18; filter: grayscale(1); cursor: not-allowed; }
.pc.onboard { opacity: 0.35; cursor: not-allowed; outline: 2px solid rgba(255,255,255,0.35); outline-offset: -2px; }
.pc:disabled:not(.used):not(.onboard) { opacity: 0.5; cursor: default; }
.hint { font-size: 12px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }
body.practice-on .palette-wrap { opacity: 0.55; }

/* ===== statistici ===== */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid var(--panel-border); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat.gold .stat-value { color: var(--gold); }
.stat.silver .stat-value { color: var(--silver); }
.stat.bronze .stat-value { color: var(--bronze); }
.stats .btn { width: 100%; }

/* ===== ghid ===== */
.guide-body p { font-size: 13.5px; line-height: 1.55; color: #c9cddb; margin: 0 0 10px; }
.scoring { width: 100%; border-collapse: collapse; margin-top: 6px; }
.scoring td { padding: 6px 0; border-top: 1px solid var(--panel-border); font-size: 13px; font-weight: 600; }
.scoring td:last-child { text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }
.mini-cards { display: inline-flex; gap: 4px; }
.mini-cards i { font-style: normal; width: 22px; height: 28px; border-radius: 4px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.mini-cards i.r { background: var(--card-r); } .mini-cards i.b { background: var(--card-b); } .mini-cards i.y { background: var(--card-y); color: #2b1d00; }

/* ===== footer ===== */
.footer { text-align: center; font-size: 12px; color: var(--muted); padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.footer .sep { margin: 0 8px; }

/* ===== modal ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,6,10,0.7); backdrop-filter: blur(6px); }
.modal-card {
  position: relative; width: min(440px, 100%); background: #151928; border: 1px solid var(--panel-border);
  border-radius: 18px; padding: 20px; box-shadow: 0 30px 60px rgba(0,0,0,0.6);
  animation: modalin 0.25s cubic-bezier(.2,.9,.3,1.1) both;
}
@keyframes modalin { from { transform: translateY(16px) scale(0.97); opacity: 0; } }
body.no-fx .modal-card { animation: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 20px; }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--panel-border); cursor: pointer; }
.setting-text { display: flex; flex-direction: column; gap: 2px; }
.setting-name { font-weight: 600; font-size: 15px; }
.setting-hint { font-size: 12px; color: var(--muted); }
.setting-range { flex-direction: column; align-items: stretch; }
.setting-range input[type="range"] { width: 100%; accent-color: var(--accent); margin-top: 6px; }
.setting-range[hidden] { display: none; }

.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-slider { position: absolute; inset: 0; border-radius: 999px; background: rgba(255,255,255,0.12); transition: background 0.2s; }
.switch-slider::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

.lang-group { display: flex; gap: 6px; }
.lang-btn { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--panel-border); background: transparent; font-weight: 700; font-size: 13px; }
.lang-btn.active { background: var(--gold); color: #1a1300; border-color: transparent; }

.done-card { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.done-card h2 { margin: 0; font-family: var(--font-display); }
.done-card p { margin: 0; color: #c9cddb; line-height: 1.5; }
.done-chest { font-size: 64px; line-height: 1; animation: chestpop 0.6s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes chestpop { from { transform: scale(0.3) rotate(-10deg); opacity: 0; } }
body.no-fx .done-chest { animation: none; }
.done-card .btn-gold { width: 100%; }

/* ===== toast ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #1c2134; border: 1px solid var(--panel-border); color: var(--text); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; z-index: 120; transition: all 0.25s; box-shadow: var(--shadow);
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

.btn-hub { padding: 10px 14px; background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
@media (max-width: 560px) { .btn-hub span { display: none; } .btn-hub { width: 42px; padding: 10px; } }
.footer { display: flex; flex-direction: column; gap: 6px; }
.disclaimer { font-size: 11px; color: rgba(139,145,168,0.7); max-width: 720px; margin: 0 auto; line-height: 1.5; }

/* credit */
.site-by { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.06); font-size: 12.5px; color: var(--muted); letter-spacing: 0.04em; }
.site-by span { font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: 0.06em;
  background: linear-gradient(90deg, #f5c542, #ffe38a 45%, #d99a1e); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 8px rgba(245,197,66,0.35)); }

.footer-links { margin-top: 10px; font-size: 12.5px; }
.footer-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.footer-links a:hover { color: var(--gold); }
