/* Catan Dice. Yellow and orange, big and plain, built for a phone lying on the table.
   Broad support on purpose: no CSS variables or grid. Rows use inline-block, and flexbox is added
   only where @supports says it works. Colors are written out each time. */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: #fff4d6; color: #3d2600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.35;
}
.page { max-width: 480px; margin: 0 auto; padding: 16px 16px 28px; }
.title { margin: 2px 0 10px; font-size: 22px; font-weight: 800; color: #c2410c; text-align: center; letter-spacing: .5px; }

button {
  font: inherit; color: inherit; margin: 0; cursor: pointer;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  -ms-touch-action: manipulation; touch-action: manipulation;  /* no double-tap zoom, no tap delay */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}
button:focus { outline: 3px solid #1c7ed6; outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
button[disabled] { opacity: .4; cursor: default; }

svg { fill: currentColor; }
.ic { width: 28px; height: 28px; vertical-align: middle; }
.ic-line { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ic-thick { stroke-width: 2.8; }
.ic-fill-solid { fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }

/* ---- rows of equal buttons: inline-block everywhere, flexbox where supported */
.modes-row, .tools { font-size: 0; white-space: nowrap; }
.modes-row > *, .tools > * { font-size: 17px; white-space: normal; display: inline-block; vertical-align: top; }
.modes-row .gap, .tools .gap { width: 3%; }
.mode { width: 48.5%; }
.tool { width: 48.5%; }
@supports (display: flex) {
  .modes-row, .tools { display: flex; }
  .mode, .tool { -webkit-box-flex: 1; flex: 1 1 0; width: auto; }
  .modes-row .gap, .tools .gap { flex: 0 0 10px; width: 10px; }
}

/* ---- the two ways to roll */
.mode {
  position: relative; padding: 8px 8px 10px; min-height: 124px; text-align: center;
  background: #ffffff; border: 3px solid #f6d58a; border-radius: 16px;
}
.mode.on { background: #ffe066; border-color: #e8590c; box-shadow: 0 3px 0 #e8590c; }
.mode.on::after {  /* a tick on the chosen one */
  content: "\2713"; position: absolute; top: -11px; right: -9px; width: 26px; height: 26px; line-height: 26px;
  border-radius: 13px; background: #e8590c; color: #ffffff; font-size: 16px; font-weight: 800;
}
.mode-icon { display: block; width: 40px; height: 40px; margin: 0 auto 2px; color: #7a4a00; }
.ic-fill { fill: #ffffff; stroke: currentColor; stroke-width: 2.4; }
.ic-text { font: bold 13px Arial, sans-serif; fill: currentColor; }
.mode-name { display: block; font-size: 20px; font-weight: 800; line-height: 1.15; }
.mode-say { display: block; margin-top: 3px; font-size: 14px; line-height: 1.3; color: #5c3d00; }

/* ---- the dice: drawn in HTML so they stay sharp and need no images */
.dice { margin: 16px 0 4px; text-align: center; cursor: pointer; }
.die {
  position: relative; display: inline-block; width: 116px; height: 116px; margin: 0 9px;
  border-radius: 22px; border: 4px solid #000; box-shadow: 0 6px 0 rgba(61, 38, 0, .25);
  -webkit-box-sizing: border-box; box-sizing: border-box;
}
.die-yellow { background: #ffd43b; border-color: #e0a100; color: #3d2600; }
.die-red { background: #d62828; border-color: #9e1b1b; color: #ffffff; }
.die.d0 { opacity: .55; }
.p { position: absolute; display: none; width: 22%; height: 22%; border-radius: 50%; background: currentColor; }
.p.a { top: 11%; left: 11%; }
.p.b { top: 11%; right: 11%; }
.p.c { top: 39%; left: 11%; }
.p.d { top: 39%; left: 39%; }
.p.e { top: 39%; right: 11%; }
.p.f { bottom: 11%; left: 11%; }
.p.g { bottom: 11%; right: 11%; }
.d1 .d,
.d2 .a, .d2 .g,
.d3 .a, .d3 .d, .d3 .g,
.d4 .a, .d4 .b, .d4 .f, .d4 .g,
.d5 .a, .d5 .b, .d5 .d, .d5 .f, .d5 .g,
.d6 .a, .d6 .b, .d6 .c, .d6 .e, .d6 .f, .d6 .g { display: block; }

.rolling { -webkit-animation: tumble .45s ease-out; animation: tumble .45s ease-out; }
.die-red.rolling { -webkit-animation-direction: reverse; animation-direction: reverse; }
@-webkit-keyframes tumble {
  0% { -webkit-transform: translateY(-14px) rotate(-18deg); }
  35% { -webkit-transform: translateY(4px) rotate(12deg); }
  65% { -webkit-transform: translateY(-4px) rotate(-6deg); }
  100% { -webkit-transform: none; }
}
@keyframes tumble {
  0% { transform: translateY(-14px) rotate(-18deg); }
  35% { transform: translateY(4px) rotate(12deg); }
  65% { transform: translateY(-4px) rotate(-6deg); }
  100% { transform: none; }
}

/* ---- the total */
.result { text-align: center; min-height: 104px; }
.result.hide { visibility: hidden; }
.total { font-size: 100px; line-height: 1.04; font-weight: 800; color: #3d2600; }
.result.seven .total { color: #c92a2a; }

/* ---- buttons */
.btn { display: block; border-radius: 18px; text-align: center; }
.roll {
  width: 100%; height: 124px; margin: 8px 0 16px; border: 0; border-radius: 26px;
  background: #e8590c; color: #ffffff; font-size: 50px; font-weight: 900; letter-spacing: 2px;
  box-shadow: 0 7px 0 #a63c06;
  /* a wiggle every couple of seconds says "tap me" */
  -webkit-animation: jiggle 2.6s ease-in-out infinite; animation: jiggle 2.6s ease-in-out infinite;
}
.roll .ic { width: 62px; height: 62px; margin: -8px 14px 0 0; }
.roll:active { -webkit-transform: translateY(5px) scale(.98); transform: translateY(5px) scale(.98); box-shadow: 0 2px 0 #a63c06; }
.roll.busy { -webkit-animation: shake .45s linear; animation: shake .45s linear; }
.roll.busy .ic { -webkit-animation: spin .45s ease-out; animation: spin .45s ease-out; }
@-webkit-keyframes jiggle {
  0%, 70%, 100% { -webkit-transform: none; }
  74% { -webkit-transform: rotate(-3deg) scale(1.04); }
  78% { -webkit-transform: rotate(3deg) scale(1.04); }
  82% { -webkit-transform: rotate(-2.5deg) scale(1.03); }
  86% { -webkit-transform: rotate(2deg) scale(1.02); }
  90% { -webkit-transform: rotate(-1deg); }
}
@keyframes jiggle {
  0%, 70%, 100% { transform: none; }
  74% { transform: rotate(-3deg) scale(1.04); }
  78% { transform: rotate(3deg) scale(1.04); }
  82% { transform: rotate(-2.5deg) scale(1.03); }
  86% { transform: rotate(2deg) scale(1.02); }
  90% { transform: rotate(-1deg); }
}
@-webkit-keyframes shake {
  0%, 100% { -webkit-transform: none; }
  20% { -webkit-transform: translateX(-8px) rotate(-2deg); }
  40% { -webkit-transform: translateX(8px) rotate(2deg); }
  60% { -webkit-transform: translateX(-6px) rotate(-1deg); }
  80% { -webkit-transform: translateX(5px) rotate(1deg); }
}
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-8px) rotate(-2deg); }
  40% { transform: translateX(8px) rotate(2deg); }
  60% { transform: translateX(-6px) rotate(-1deg); }
  80% { transform: translateX(5px) rotate(1deg); }
}
@-webkit-keyframes spin { from { -webkit-transform: rotate(0); } to { -webkit-transform: rotate(360deg); } }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.tool {
  min-height: 72px; padding: 6px 4px; background: #ffffff; border: 3px solid #f6d58a;
  font-size: 17px; font-weight: 700; line-height: 1.15;
}
.tool .ic { display: block; margin: 0 auto 3px; }
.tool:active { background: #fff0b8; }
.tool.ask { background: #ffe3e3; border-color: #c92a2a; color: #c92a2a; }
.ic-off { display: none; }
.tool.off .ic-on { display: none; }
.tool.off .ic-off { display: inline; }
.tool.off { color: #8a6d3b; }

/* ---- roll tracker: closed until opened */
.tracker { margin-top: 16px; background: #ffffff; border: 3px solid #f6d58a; border-radius: 18px; overflow: hidden; }
.tracker-head {
  display: block; width: 100%; min-height: 64px; padding: 8px 14px; border: 0; background: #fff9e6; text-align: left;
}
.tracker-head .ic { float: left; margin: 8px 12px 0 0; color: #e8590c; }
.tracker-head .chev { float: right; margin: 8px 0 0 8px; color: #7a4a00; -webkit-transition: -webkit-transform .2s; transition: transform .2s; }
.tracker.open .chev { -webkit-transform: rotate(180deg); transform: rotate(180deg); }
.th-text { display: block; overflow: hidden; }
.th-text b { display: block; font-size: 20px; }
.th-text span { display: block; font-size: 15px; color: #7a4a00; }
.tracker-body { display: none; padding: 10px 10px 14px; border-top: 2px solid #f6d58a; }
.tracker.open .tracker-body { display: block; }

.chart { font-size: 0; white-space: nowrap; }
.col { display: inline-block; width: 9.09%; vertical-align: bottom; text-align: center; font-size: 15px; white-space: normal; }
.count { display: block; height: 20px; font-weight: 700; color: #5c3d00; }
.well { position: relative; display: block; height: 140px; margin: 0 2px; background: #fff3cf; border-radius: 6px 6px 0 0; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #f59f00; border-radius: 6px 6px 0 0; }
.exp { position: absolute; left: -2px; right: -2px; bottom: 0; height: 3px; margin-bottom: -1px; background: #3d2600; display: none; }
.lab { display: block; padding-top: 3px; font-size: 17px; font-weight: 800; border-top: 2px solid #3d2600; }
.col.hot .lab { color: #c92a2a; }
.col.seven .bar { background: #9c6644; }
.legend { margin: 10px 0 0; font-size: 14px; color: #5c3d00; text-align: center; }
.key-bar, .key-exp { display: inline-block; width: 16px; vertical-align: middle; margin: 0 4px 0 10px; }
.key-bar { height: 14px; background: #f59f00; border-radius: 3px; }
.key-exp { height: 3px; background: #3d2600; }
.deck-line { display: none; margin: 8px 0 0; font-size: 15px; font-weight: 700; text-align: center; color: #7a4a00; }
.recent-title { margin: 14px 0 6px; font-size: 14px; color: #5c3d00; }
.recent { margin: 0; padding: 0; list-style: none; font-size: 0; }
.recent li {
  display: inline-block; width: 38px; height: 38px; margin: 0 6px 6px 0; line-height: 38px; text-align: center;
  border-radius: 19px; background: #ffe066; font-size: 18px; font-weight: 800;
}
.recent li:first-child { background: #e8590c; color: #ffffff; }
.recent li.seven { background: #9c6644; color: #ffffff; }
.recent li.none { width: auto; padding: 0 12px; background: #fff3cf; font-size: 15px; font-weight: 400; }

.nojs { padding: 12px; background: #ffe3e3; border-radius: 12px; font-weight: 700; }
.foot { margin: 22px 0 0; font-size: 12px; color: #8a6d3b; text-align: center; }

/* small phones: a little tighter so Roll stays on screen */
@media (max-width: 359px) {
  .die { width: 100px; height: 100px; margin: 0 6px; }
  .total { font-size: 84px; }
  .result { min-height: 90px; }
  .roll { height: 108px; font-size: 42px; }
  .roll .ic { width: 52px; height: 52px; }
  .mode-say { font-size: 13px; }
}
/* bigger screens: bigger dice */
@media (min-width: 420px) {
  .die { width: 132px; height: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  .rolling, .roll, .roll.busy, .roll.busy .ic { -webkit-animation: none; animation: none; }
  .tracker-head .chev { -webkit-transition: none; transition: none; }
}
