/*
 * How it works.
 *
 * Built on the season palette so the page is unmistakably the same product as
 * the rest of the site. The only new idea here is the table, which has to read
 * as a broadcast at a glance: a dark felt, chrome pinned to the corners, and
 * one thing in the middle asking to be pressed.
 */

/* ---------------- the three steps ---------------- */

.dm-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 44px;
}

.dm-step {
  background: var(--tile);
  border: 1px solid #232327;
  border-radius: 16px;
  padding: 28px;
}
.dm-step-n { font-weight: 800; font-size: 30px; margin-bottom: 10px; letter-spacing: .01em; }
.dm-step p { margin: 0; font-size: 15px; color: var(--mute); line-height: 1.6; }

.dm-step.is-green { background: rgba(63, 220, 111, .05); border-color: var(--green); }
.dm-step.is-green .dm-step-n { color: var(--green); }
.dm-step.is-green p { color: var(--ink); }

.dm-step.is-gold { background: rgba(255, 214, 110, .05); border-color: var(--legendary); }
.dm-step.is-gold .dm-step-n { color: var(--legendary); }

/* ---------------- the table ---------------- */

.dm-table {
  position: relative;
  width: 100%;
  height: 640px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: radial-gradient(900px 480px at 50% 30%, #0d1f14, #050506 75%);
}

/* Corner chrome. */
.dm-flag {
  position: absolute; top: 18px; left: 22px; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 800; letter-spacing: .16em; color: #fff;
  background: rgba(201, 42, 48, .7); border-radius: 5px; padding: 6px 12px;
}
.dm-flag::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: #fff; animation: dmBlink 1.2s infinite;
}

.dm-watch {
  position: absolute; top: 18px; right: 22px; z-index: 2;
  font-size: 14px; font-weight: 700; letter-spacing: .1em; color: rgba(231, 231, 231, .8);
}

.dm-cam {
  position: absolute; top: 64px; left: 22px; z-index: 2;
  width: 170px; height: 100px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--tile);
  border: 1px solid rgba(255, 255, 255, .25);
  font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--dim);
}

/* Seats. */
.dm-seat { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; z-index: 2; }
.dm-dealer { top: 56px; }
.dm-player { top: 318px; }

.dm-seat-label {
  font-size: 12px; letter-spacing: .2em; color: rgba(231, 231, 231, .55); margin-bottom: 8px;
}
.dm-player .dm-seat-label { margin: 6px 0 0; font-weight: 800; }
.dm-seat-label.is-green { color: var(--green); }

.dm-cards { display: flex; gap: 8px; justify-content: center; min-height: 82px; }

.dm-card {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 80px; border-radius: 9px;
  font-weight: 800; font-size: 20px;
  background: #f4f4f6; color: #0a0a0b;
  box-shadow: 0 5px 14px rgba(0, 0, 0, .5);
  animation: dmDeal .4s cubic-bezier(.2, 1.2, .4, 1) both;
}
.dm-card.is-red { color: var(--red); }
.dm-card.is-hole {
  background: rgba(26, 26, 32, .85); color: var(--dim);
  border: 1px dashed #3a3a42; box-shadow: none;
}

/* Phase and pot. */
.dm-status {
  position: absolute; left: 50%; top: 252px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; z-index: 2;
}

.dm-chip {
  font-size: 11px; font-weight: 800; letter-spacing: .14em;
  border-radius: 5px; padding: 5px 12px;
  background: rgba(255, 255, 255, .08); color: var(--mute); border: 1px solid #3a3a42;
}
.dm-chip.is-betting {
  background: rgba(63, 220, 111, .18); color: var(--green);
  border-color: rgba(63, 220, 111, .5); animation: dmGlow 1.6s infinite;
}
.dm-chip.is-vote {
  background: rgba(255, 214, 110, .15); color: var(--legendary); border-color: rgba(255, 214, 110, .5);
}
.dm-chip.is-win { background: rgba(63, 220, 111, .2); color: var(--green); border-color: var(--green); }
.dm-chip.is-lose { background: rgba(255, 90, 95, .2); color: var(--danger); border-color: var(--danger); }
.dm-chip.is-push { background: rgba(255, 255, 255, .1); color: #c9c9d1; border-color: var(--dim); }

.dm-pot {
  display: flex; align-items: baseline; gap: 8px; font-size: 13px;
  background: rgba(6, 6, 9, .5); border: 1px solid rgba(255, 214, 110, .4);
  border-radius: 999px; padding: 6px 16px;
}
.dm-pot em { font-style: normal; letter-spacing: .14em; color: rgba(231, 231, 231, .55); }
.dm-pot b { font-weight: 800; color: var(--legendary); }

/* The result flash. */
.dm-fx {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  z-index: 4; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: rgba(6, 6, 9, .9); border: 1px solid var(--green);
  border-radius: 16px; padding: 22px 52px;
  box-shadow: 0 0 70px rgba(63, 220, 111, .4);
}
.dm-fx[hidden] { display: none; }
.dm-fx.is-red { border-color: var(--danger); box-shadow: 0 0 70px rgba(255, 90, 95, .4); }
.dm-fx.is-flat { border-color: var(--ink); box-shadow: 0 0 70px rgba(231, 231, 231, .25); }

.dm-fx-label { font-size: 16px; font-weight: 800; letter-spacing: .3em; color: var(--green); }
.dm-fx.is-red .dm-fx-label { color: var(--danger); }
.dm-fx.is-flat .dm-fx-label { color: var(--ink); }
.dm-fx-text { font-size: 64px; font-weight: 800; color: #fff; line-height: 1; }
.dm-fx-sub { font-size: 13px; font-weight: 700; letter-spacing: .2em; color: rgba(231, 231, 231, .55); }
.dm-fx-sub:empty { display: none; }

/* Your open bet. */
.dm-ticket {
  position: absolute; right: 22px; top: 64px; z-index: 3;
  display: flex; flex-direction: column; gap: 5px;
  background: rgba(6, 6, 9, .75); border: 1px solid var(--green);
  border-radius: 12px; padding: 13px 18px;
  box-shadow: 0 0 22px rgba(63, 220, 111, .27);
  animation: dmIn .3s ease;
}
.dm-ticket[hidden] { display: none; }
.dm-ticket.is-against { border-color: var(--danger); box-shadow: 0 0 22px rgba(255, 90, 95, .27); }
.dm-ticket-top { font-size: 10px; font-weight: 800; letter-spacing: .22em; color: var(--green); }
.dm-ticket.is-against .dm-ticket-top { color: var(--danger); }
.dm-ticket-mid { font-size: 18px; font-weight: 800; color: #fff; }
.dm-ticket-low { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--legendary); }

/* The controls. */
.dm-panel {
  position: absolute; left: 22px; bottom: 22px; z-index: 3;
  width: 480px; max-width: calc(100% - 44px);
  background: rgba(6, 6, 9, .7); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px; padding: 13px 15px;
}

.dm-panel-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dm-panel-title { font-size: 11px; font-weight: 800; letter-spacing: .16em; color: var(--ink); }
.dm-panel-note {
  font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--dim); text-align: center;
}

.dm-stakes { display: flex; gap: 5px; }
.dm-stake {
  font: inherit; font-size: 11px; font-weight: 800; cursor: pointer;
  border-radius: 6px; padding: 3px 10px;
  background: rgba(255, 255, 255, .06); color: var(--legendary);
  border: 1px solid rgba(255, 214, 110, .35);
}
.dm-stake.is-on { background: var(--legendary); color: var(--panel); border-color: var(--legendary); }

.dm-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.dm-side {
  font: inherit; font-size: 12px; font-weight: 800; letter-spacing: .08em;
  border-radius: 8px; padding: 10px 0; cursor: pointer;
}
.dm-side.is-with {
  background: rgba(63, 220, 111, .2); color: var(--green); border: 1px solid rgba(63, 220, 111, .5);
}
.dm-side.is-against {
  background: rgba(255, 90, 95, .18); color: var(--danger); border: 1px solid rgba(255, 90, 95, .5);
}
/* Once a side is taken the other greys out rather than disappearing. */
.dm-side.is-done { cursor: default; background: rgba(255, 255, 255, .06); color: var(--dim); border-color: transparent; }
.dm-side.is-with.is-mine { background: var(--green); color: #04120a; border-color: var(--green); }
.dm-side.is-against.is-mine { background: var(--danger); color: #120404; border-color: var(--danger); }

.dm-vote {
  position: relative; display: flex; align-items: center; overflow: hidden;
  font: inherit; border-radius: 7px; padding: 8px 12px; cursor: pointer;
  background: transparent; border: 1px solid rgba(34, 229, 95, .47);
}
.dm-vote.is-stand { border-color: rgba(56, 168, 255, .47); }
.dm-vote:disabled { cursor: default; }
.dm-vote.is-mine { border-color: #22e55f; box-shadow: 0 0 14px rgba(34, 229, 95, .4); }
.dm-vote.is-stand.is-mine { border-color: #38a8ff; box-shadow: 0 0 14px rgba(56, 168, 255, .4); }

.dm-vote-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(34, 229, 95, .6), rgba(34, 229, 95, .33));
  transition: width .5s ease;
}
.dm-vote.is-stand .dm-vote-fill {
  background: linear-gradient(90deg, rgba(56, 168, 255, .6), rgba(56, 168, 255, .33));
}
.dm-vote-line {
  position: relative; display: flex; justify-content: space-between; width: 100%;
  font-size: 13px; font-weight: 800; color: #fff;
}

.dm-result { text-align: center; padding: 2px 0; }
.dm-result-title { font-weight: 800; font-size: 17px; text-transform: uppercase; letter-spacing: .04em; }
.dm-result-title.is-green { color: var(--green); }
.dm-result-title.is-red { color: var(--danger); }
.dm-result-title.is-flat { color: #c9c9d1; }
.dm-result-sub { font-size: 12px; letter-spacing: .1em; color: #c9c9d1; margin-top: 5px; }

/* The crowd rail. */
.dm-chat {
  position: absolute; right: 22px; bottom: 22px; z-index: 2;
  width: 300px; display: flex; flex-direction: column; gap: 7px;
}
.dm-msg { font-size: 13px; animation: dmIn .3s ease both; }
.dm-msg b { font-weight: 800; }
.dm-msg span { color: #e5e5ec; }

/* Start. */
.dm-veil {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: rgba(4, 4, 6, .55);
}
.dm-veil[hidden] { display: none; }

.dm-start {
  font: inherit; font-size: 20px; font-weight: 800; letter-spacing: .2em;
  color: #04120a; background: var(--green);
  border: none; border-radius: 999px; padding: 18px 54px; cursor: pointer;
  animation: dmGlow 1.8s infinite;
}
.dm-start:hover { filter: brightness(1.12); }
.dm-veil-note { font-size: 14px; font-weight: 700; letter-spacing: .16em; color: rgba(231, 231, 231, .6); }

.dm-smallprint {
  margin: 14px 0 44px;
  font-size: 12px; line-height: 1.7; letter-spacing: .04em; color: var(--dim); max-width: 720px;
}

/* ---------------- targets ---------------- */

.dm-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 44px; }
.dm-metric { border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.dm-metric b { display: block; font-weight: 800; font-size: 40px; }
.dm-metric b.is-green { color: var(--green); }
.dm-metric b.is-gold { color: var(--legendary); }
.dm-metric span {
  display: block; margin-top: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--mute);
}

/* ---------------- who it is for ---------------- */

.dm-who { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dm-aud { background: var(--tile); border: 1px solid #232327; border-radius: 16px; padding: 28px; }
.dm-aud-tag { font-size: 11px; font-weight: 800; letter-spacing: .2em; margin-bottom: 12px; }
.dm-aud h3 { margin: 0 0 10px; font-weight: 800; font-size: 22px; letter-spacing: .01em; }
.dm-aud p { margin: 0; font-size: 14px; color: var(--mute); line-height: 1.6; }
.dm-aud-go {
  display: inline-block; margin-top: 16px;
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-decoration: none;
}
/* Scoped: a bare .is-green would repaint anything on the page that carries it. */
.dm-aud-tag.is-green, .dm-aud-go.is-green { color: var(--green); }
.dm-aud-tag.is-gold,  .dm-aud-go.is-gold  { color: var(--legendary); }
.dm-aud-tag.is-epic,  .dm-aud-go.is-epic  { color: var(--epic); }

/* ---------------- motion ---------------- */

@keyframes dmBlink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes dmIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes dmDeal {
  0% { transform: translateY(-40px) rotate(-10deg); opacity: 0; }
  60% { transform: translateY(3px) rotate(2deg); opacity: 1; }
  100% { transform: none; }
}
@keyframes dmGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(63, 220, 111, .25); }
  50% { box-shadow: 0 0 26px rgba(63, 220, 111, .6); }
}

/*
 * A table that deals, blinks, glows and slides is a lot of movement to put in
 * front of somebody who has asked their system for less of it. The information
 * is all in the text and the numbers, so it survives losing every animation.
 */
@media (prefers-reduced-motion: reduce) {
  .dm-flag::before, .dm-aud, .dm-msg, .dm-ticket, .dm-start, .dm-chip { animation: none; }
  .dm-vote-fill { transition: none; }
}

/* ---------------- narrow ---------------- */

@media (max-width: 1100px) {
  .dm-steps, .dm-who { grid-template-columns: 1fr; }
  .dm-metrics { grid-template-columns: 1fr 1fr; }
  .dm-chat { display: none; }       /* the rail has nowhere to go beside the panel */
  .dm-panel { width: auto; right: 22px; }
}

/*
 * A broadcast frame is a fixed rectangle with things pinned to its corners, and
 * a phone has no room for corners. Nudging the offsets was tried first and the
 * result was a bet slip sitting squarely on top of the streamer's hand: with
 * everything absolutely placed each element knows where it is, not what it is
 * covering.
 *
 * So below this width the table stops being a frame and becomes an ordinary
 * column, read top to bottom: the dealer, the clock and the pot, the hand, your
 * open bet, then what you can do about it. Only the corner chrome and the two
 * overlays stay pinned, which is what they are for.
 */
@media (max-width: 720px) {
  .dm-table {
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 58px 14px 16px;
  }

  .dm-seat, .dm-status, .dm-ticket, .dm-panel {
    position: static;
    transform: none;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }
  .dm-status { justify-content: center; }

  .dm-cam, .dm-chat { display: none; }
  .dm-flag { top: 14px; left: 14px; font-size: 10px; letter-spacing: .12em; padding: 5px 9px; }
  .dm-watch { top: 16px; right: 14px; font-size: 11px; letter-spacing: .06em; }

  .dm-card { width: 44px; height: 63px; font-size: 16px; }
  .dm-cards { min-height: 65px; }

  /* Forty pixel figures do not fit two to a phone once the padding is paid. */
  .dm-metric { padding: 16px; }
  .dm-metric b { font-size: 26px; }
  .dm-metric span { font-size: 11px; letter-spacing: .08em; }
  .dm-step, .dm-aud { padding: 20px; }
  .dm-step-n { font-size: 24px; }
  .dm-fx { padding: 16px 28px; }
  .dm-fx-text { font-size: 40px; }
  .dm-start { font-size: 15px; padding: 14px 32px; }
  .dm-veil { padding: 24px; text-align: center; }
}
