/* =============================
   Order These — v3.1
   ============================= */

:root{
  --bg: #000;
  --fg: #fff;

  --tileSize: 104px; /* square tiles */
  --tileRadius: 16px;

  --tileBorder: 2px;
  --tileBorderBlue: #2d74ff;
  --tileBorderYellow: #f0c419;
  --tileBorderGreen: #36c27a;

  --tilePad: 10px;

  --titleSize: 14px;
  --valueSize: 12px;

  --shadow: 0 10px 24px rgba(0,0,0,0.35);
}

*{ box-sizing:border-box; }

/* Ensure the HTML hidden attribute always hides elements */
[hidden]{
  display: none !important;
}

html, body{
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

body{
  padding-top: 66px; /* space for fixed header */
}

main{
  max-width: 740px;
  margin: 0 auto;
  padding: 16px 14px 26px;
}

/* iOS tap ergonomics */
button,
.icon-btn,
.menu-item{
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Header */
.topbar{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;

  height: 58px;
  padding: 0 10px;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;

  background: #000;
}

.left-actions{
  display: flex;
  gap: 4px;              /* slightly closer together */
  padding-left: 12px;
}

.icon-btn{
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
}

/* Info icon size is the reference (perfect) */
.icon-img{
  width: 25px;
  height: 25px;
  display: block;
  object-fit: contain;
}

/* Menu icon looked larger — reduce to match */
.menu-img{
  width: 22px;
  height: 22px;
}

.icon-fallback{
  font-size: 18px;
  line-height: 1;
}

.brand{
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo{
  height: 30px;
  width: auto;
  display: block;
}

.logo-text{
  font-weight: 900;
  letter-spacing: 0.4px;
}

/* Menu dropdown */
.menu-dropdown{
  position: fixed;
  top: 58px;         /* sits just under the header */
  left: 10px;

  background: #121212;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 8px;
  z-index: 2000;

  box-shadow: var(--shadow);
}

.menu-item{
  display: block;
  padding: 10px 12px;
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.2;
}

.menu-item:active{
  background: rgba(255,255,255,0.12);
}

.meta{
  margin: 10px 0 8px;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.subtitle{
  margin: 0 0 10px;
  font-size: 15px;
  text-align: center;
}

.message{
  margin: 8px 0 12px;
  min-height: 20px;
  text-align: center;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
}

/* Grid container */
.event-buttons{
  display: grid;
  gap: 10px;
  justify-content: center;
  align-content: center;

  /* default small screen: 2 cols x 3 rows */
  grid-template-columns: repeat(2, var(--tileSize));
}

/* larger screens: 3 cols x 2 rows */
@media (min-width: 420px){
  .event-buttons{
    grid-template-columns: repeat(3, var(--tileSize));
  }
}

.event-btn{
  width: var(--tileSize);
  height: var(--tileSize);

  border-radius: var(--tileRadius);
  border: var(--tileBorder) solid rgba(255,255,255,0.18);
  background: #fff;

  color: #000;
  padding: var(--tilePad);

  display: flex;
  align-items: center;
  justify-content: center;

  position: relative;
  cursor: pointer;

  user-select: none;
}

.event-btn:active{
  filter: brightness(0.92);
}

.event-btn.selected{
  filter: brightness(0.88);
}

/* Feedback borders */
.event-btn.fb-blue{ border-color: var(--tileBorderBlue); }
.event-btn.fb-yellow{ border-color: var(--tileBorderYellow); }
.event-btn.fb-green{ border-color: var(--tileBorderGreen); }

.choice-badge{
  position: absolute;
  right: 8px;
  bottom: 8px;

  min-width: 22px;
  height: 22px;
  padding: 0 6px;

  border-radius: 999px;
  background: rgba(0,0,0,0.14);
  color: #000;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  font-weight: 800;

  box-shadow: 0 2px 10px rgba(0,0,0,0.14);
  pointer-events: none;
}

/* (Optional) if you use a class like badge-correct in JS, keep it subtle */
.choice-badge.badge-correct{
  opacity: 0.55;
}

/* Text wrapper */
.event-left{
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;

  align-items: center;
  justify-content: center;
  text-align: center;
}

.event-title{
  font-weight: 800;
  line-height: 1.15;
  color: #000;

  font-size: var(--titleSize);

  white-space: normal;

  /* Never split a word across lines */
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;

  /* Better line breaks where supported */
  text-wrap: balance;
}

.event-title.is-image{
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-img{
  width: min(72%, 140px);
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Value reveal (final reveal only) */
.event-value{
  margin-top: 6px;
  font-size: var(--valueSize);
  color: rgba(0, 0, 0, 0.72);
  font-weight: 400;

  white-space: normal;

  /* Never split a word across lines */
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;

  text-wrap: balance;
}

/* Controls row */
.row{
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

button{
  font: inherit;
}

button.secondary{
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: #101010;
  color: #fff;
  cursor: pointer;
}

button.secondary:disabled{
  opacity: 0.4;
  cursor: default;
}

/* Modal */
.modal[hidden]{
  display: none !important;
}

.modal{
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 76px 14px 14px;
}

.modal-card{
  width: min(680px, 100%);
  border-radius: 16px;
  background: #121212;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
}

.modal-header h2{
  margin: 0;
  font-size: 16px;
}

.close-btn{
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 12px;
}

.close-btn:active{
  background: rgba(255,255,255,0.10);
}

.modal-body{
  padding: 14px;
  color: rgba(255,255,255,0.9);
}

.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: -1;
}

/* Build line */
.buildline{
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  opacity: 0.65;
}

/* Archive list */
.archive-list{
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.archive-link{
  display: block;
  padding: 12px 12px;
  border-radius: 14px;
  background: #101010;
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  text-decoration: none;
}

.archive-link:active{
  background: rgba(255,255,255,0.08);
}
