@font-face {
  font-family: 'LowresPixel';
  src: url('../Assets/Fonts/lower-pixel/LowresPixel-Regular.otf') format('opentype');
}

@font-face {
  font-family: 'ArcadeClassic';
  src: url('../Assets/Fonts/arcadeclassic (1)/ARCADECLASSIC.TTF') format('truetype');
}

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

:root {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --border: #2e2e2e;
  --accent: #c9a84c;
  --accent-dim: #8a6e2f;
  --text: #f0ece4;
  --text-muted: #888;
  --myra-panel-width: 280px;
  --rcu-col-width: 200px;
}

body {
  background: var(--bg) url('../Assets/UI/bar_background.png') center center / cover no-repeat;
  color: var(--text);
  font-family: 'LowresPixel', monospace;
  height: 100vh;
  overflow: hidden;
}

/* ── VIGNETTE ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.75) 100%);
  pointer-events: none;
  z-index: 997;
}

/* ── FILM GRAIN (GPU-friendly — only animates transform, no repaint) ── */
body::after {
  content: '';
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.04;
  pointer-events: none;
  z-index: 998;
  will-change: transform;
  animation: grain 0.8s steps(2) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3%, -4%); }
  50%  { transform: translate(3%, 2%); }
  75%  { transform: translate(-2%, 4%); }
  100% { transform: translate(2%, -2%); }
}

/* ── MAIN LAYOUT ── */
#draw-screen {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
}

/* ── RED CORAL COLUMN ── */
#rcu-column {
  width: var(--rcu-col-width);
  min-width: var(--rcu-col-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  background: rgba(0,0,0,0.88);
  border-right: 1px solid var(--border);
}

.poster-link {
  display: block;
  width: 100%;
  padding: 0 12px;
}

.side-poster {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.2s;
}

.poster-link:hover .side-poster {
  opacity: 1;
  transform: scale(1.03);
}

#rcu-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

#rcu-text {
  color: var(--text-muted);
  font-family: 'LowresPixel', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: center;
}

#rcu-logo {
  width: 160px;
  height: auto;
  opacity: 0.8;
  transition: opacity 0.2s;
}

#rcu-link:hover #rcu-logo { opacity: 1; }
#rcu-link:hover #rcu-text { color: var(--text); }

/* ── LEFT PANEL ── */
#left-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  height: 100%;
  padding: 16px 16px 12px;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

/* ── HEADER ── */
header { text-align: center; margin-top: 40px; }

.title-img {
  max-width: clamp(280px, 50vw, 600px);
  max-height: 350px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text);
  margin-top: 2px;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 6px rgba(0,0,0,0.9);
}

/* ── CANVAS FRAME (corners) ── */
#canvas-frame {
  position: relative;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0.9;
}

.corner.tl { top: 0; left: 0;  border-width: 2px 0 0 2px; }
.corner.tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
.corner.bl { bottom: 0; left: 0;  border-width: 0 0 2px 2px; }
.corner.br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

/* ── CANVAS ── */
#canvas-wrapper {
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 2px;
  background: #ffffff;
  cursor: crosshair;
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.08),
    0 0 30px rgba(201, 168, 76, 0.08);
}

#drawing-canvas { display: block; }

/* ── TOOLBAR ── */
#toolbar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(0,0,0,0.75);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 18px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-group label {
  font-size: 0.72rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* ── CUSTOM RANGE SLIDER ── */
#brush-size {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#brush-size::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(201, 168, 76, 0.5);
  transition: transform 0.1s;
}

#brush-size::-webkit-slider-thumb:hover { transform: scale(1.3); }

/* ── COLOR SWATCHES ── */
.colors { flex-wrap: wrap; }

#color-swatches {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.swatch:hover { transform: scale(1.25); box-shadow: 0 0 6px rgba(255,255,255,0.2); }
.swatch.active { border-color: var(--accent); transform: scale(1.2); box-shadow: 0 0 8px rgba(201,168,76,0.5); }

#custom-color {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  background: none;
  padding: 0;
}

/* ── TOOL BUTTONS ── */
.tool-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'LowresPixel', monospace;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}

.tool-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(201,168,76,0.06);
  box-shadow: 0 0 8px rgba(201,168,76,0.15);
}

.tool-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(201,168,76,0.1);
  box-shadow: 0 0 8px rgba(201,168,76,0.2);
}

/* ── RATE BUTTON ── */
#rate-btn {
  background: var(--accent);
  color: #0d0d0d;
  border: none;
  padding: 12px 44px;
  font-family: 'ArcadeClassic', monospace;
  font-size: 1.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
}

#rate-btn:hover {
  background: #e0bb55;
  transform: scale(1.03);
  box-shadow: 0 0 30px rgba(201, 168, 76, 0.5);
}

#rate-btn:active { transform: scale(0.97); }

@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(201,168,76,0.3); }
  50%       { box-shadow: 0 0 40px rgba(201,168,76,0.8); }
}

#rate-btn.draw-again {
  animation: btn-pulse 1.5s ease-in-out infinite;
}

/* ── MYRA PANEL ── */
#myra-panel {
  width: var(--myra-panel-width);
  min-width: var(--myra-panel-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 12px;
  border-left: 1px solid var(--border);
  background: rgba(0,0,0,0.88);
  overflow-y: auto;
}

/* ── MYRA IMAGE ANIMATIONS ── */
#myra-img {
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  transition: opacity 0.25s, filter 0.5s;
}

.myra-frame-low {
  filter: drop-shadow(0 0 6px rgba(230,57,70,1)) drop-shadow(0 0 18px rgba(230,57,70,0.6));
}

.myra-frame-mid {
  filter: drop-shadow(0 0 6px rgba(244,162,97,1)) drop-shadow(0 0 18px rgba(244,162,97,0.6));
}

.myra-frame-high {
  filter: drop-shadow(0 0 6px rgba(201,168,76,1)) drop-shadow(0 0 18px rgba(201,168,76,0.6));
}

.myra-frame-perfect {
  filter: drop-shadow(0 0 10px rgba(255,240,160,1)) drop-shadow(0 0 30px rgba(255,240,160,0.9)) drop-shadow(0 0 60px rgba(255,240,160,0.6));
}

@keyframes myra-shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  15%       { transform: translateX(-8px) rotate(-3deg); }
  30%       { transform: translateX(8px)  rotate(3deg); }
  45%       { transform: translateX(-6px) rotate(-2deg); }
  60%       { transform: translateX(6px)  rotate(2deg); }
  75%       { transform: translateX(-3px) rotate(-1deg); }
}

@keyframes myra-bounce {
  0%   { transform: scale(0.85) translateY(16px); opacity: 0; }
  60%  { transform: scale(1.06) translateY(-4px); opacity: 1; }
  100% { transform: scale(1)    translateY(0);    opacity: 1; }
}

@keyframes myra-glow {
  0%   { transform: scale(0.9); opacity: 0; filter: brightness(2); }
  50%  { filter: brightness(1.4); }
  100% { transform: scale(1);   opacity: 1; filter: brightness(1); }
}

.myra-shake  { animation: myra-shake  0.55s ease; }
.myra-bounce { animation: myra-bounce 0.5s  ease forwards; }
.myra-glow   { animation: myra-glow   0.5s  ease forwards; }

/* ── RATING DISPLAY ── */
#rating-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 3rem;
}

@keyframes rating-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1);   opacity: 1; }
}

.rating-pop { animation: rating-pop 0.4s ease forwards; }

#rating-number {
  font-family: 'ArcadeClassic', monospace;
  font-size: 4rem;
  font-weight: bold;
  line-height: 1;
  transition: color 0.4s;
  text-shadow: 0 0 20px currentColor;
}

#rating-label {
  font-size: 1.2rem;
  color: var(--text-muted);
}

#myra-message {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
  text-align: center;
  min-height: 5em;
  transition: color 0.4s;
}

.message-low     { color: #e63946; }
.message-mid     { color: #f4a261; }
.message-high    { color: #c9a84c; }
.message-perfect { color: #fff0a0; }

/* ── SHARE BUTTON ── */
#share-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 8px 20px;
  font-family: 'ArcadeClassic', monospace;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

#share-btn:hover {
  background: rgba(201,168,76,0.1);
  box-shadow: 0 0 12px rgba(201,168,76,0.3);
}

/* ── STUDIO LOGO ── */
#studio-logo {
  position: fixed;
  bottom: 14px;
  right: 16px;
  width: 72px;
  height: auto;
  opacity: 0.75;
  z-index: 100;
  cursor: pointer;
}

#rcu-corner-logo {
  position: fixed;
  top: 14px;
  right: 16px;
  width: 72px;
  height: auto;
  opacity: 0.75;
  z-index: 100;
  cursor: pointer;
  transition: opacity 0.15s;
}

#rcu-corner-logo:hover { opacity: 1; }

/* ── MOBILE LAYOUT ── */
@media (max-width: 768px) {

  body { overflow-y: auto; height: auto; }

  #draw-screen {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  /* Hide side column on mobile */
  #rcu-column { display: none; }

  /* Hide fixed corner logos on mobile */
  #rcu-corner-logo,
  #studio-logo { display: none; }

  /* Left panel fills full width */
  #left-panel {
    width: 100%;
    padding: 12px 12px 16px;
    gap: 10px;
    height: auto;
    overflow: visible;
  }

  header { margin-top: 12px; }

  .title-img {
    max-width: clamp(200px, 70vw, 360px);
    max-height: 100px;
  }

  .subtitle { font-size: 0.8rem; }

  /* Rate button */
  #rate-btn {
    width: 100%;
    font-size: 1.4rem;
    padding: 12px 20px;
  }

  /* Myra panel becomes a horizontal strip below */
  #myra-panel {
    width: 100%;
    min-width: 0;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 16px 12px 24px;
  }

  #myra-img {
    max-width: 120px;
    flex-shrink: 0;
  }

  #myra-message {
    font-size: 0.8rem;
    min-height: 0;
    text-align: left;
    max-width: 180px;
  }

  #rating-display { flex-direction: column; align-items: center; gap: 0; }

  #rating-number { font-size: 3rem; }

  #share-btn { width: 100%; text-align: center; }

  /* Toolbar wraps cleanly */
  #toolbar {
    gap: 12px;
    padding: 8px 10px;
  }

  .swatch {
    width: 20px;
    height: 20px;
  }

  #custom-color {
    width: 20px;
    height: 20px;
  }

  #brush-size { width: 70px; }

  .tool-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }
}
