/*
 * Practice tools (index.py, index2.py, index_waiting.py and their iframe / AJAX parts).
 * Loaded after css/pure-min.css and shared/site.css. Everything is scoped under .practice
 * (the tool area inside the page panel) or .practice-page / .practice-frame, so the shared
 * look is not affected; the tile classes of the drag & drop tool (.tile_selection, .tile_empty...)
 * are tool-specific and left unscoped because jQuery UI clones them into <body> while dragging.
 *
 * The game "table" is the felt mat in its wooden frame (.mat), as on the old pages; everything
 * around it follows the site's plain style.
 */

/* ---------- Page frame ---------- */
.practice { padding: 32px 28px 36px; }
.practice img { max-width: none; }            /* site.css shrinks images to their box; tiles keep their size */
.practice h2 { margin: 30px 0 18px; text-align: center; }
.practice-page .um-sublinks a[aria-current] { border-bottom-color: var(--purple); color: #000; }
.practice-page .um-credits a { color: #fff; }

/* Horizontal scrolling instead of overflowing the panel (tables, results) */
.practice-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* ---------- The table: felt mat in the wooden frame ---------- */
.board-fit { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 auto 26px; }
.board { min-width: 850px; }
.practice-waits .board { min-width: 800px; }
.practice .mat {
  position: relative;
  background: #2a8a55 url(../mat.jpg);
  padding: 20px 22px 24px;
  border: 15px solid #ccb089;
  border-image: url(../wooden_frame.jpg) 30 38 stretch;
  color: #fff; font-weight: 700;
}
.practice .mat .tiles {
  -webkit-filter: drop-shadow(-5px -15px 10px rgba(0, 0, 0, .3));
  filter: drop-shadow(-5px -15px 10px rgba(0, 0, 0, .3));
  white-space: nowrap;
}
.practice .mat center { line-height: 1.2; }
.practice .mat i { font-weight: 400; font-size: 14px; color: rgba(255, 255, 255, .85); }
/* Round wind / seat wind labels, as on the old pages */
.board .mat > span { display: inline-flex; align-items: flex-end; gap: 6px; margin: 0 14px 4px 0; }
.board .mat > span > span:first-child { font-size: 13px; font-weight: 400; color: #fff; padding-bottom: 8px; white-space: nowrap; }
.board .mat > span .tiles { filter: none; -webkit-filter: none; }

/* ---------- Buttons: the site's flat buttons ---------- */
.practice .pure-button {
  font: 400 13px/1.4 Montserrat, sans-serif; letter-spacing: 2px; text-transform: uppercase;
  border-radius: 0; border: 1px solid var(--purple); background: #fff; color: var(--purple-dark); text-shadow: none;
  transition: background .15s, color .15s;
}
.practice .pure-button:hover, .practice .pure-button:focus { background: var(--purple); color: #fff; background-image: none; }
.practice .button-success, .practice .button-error { color: #fff; font-size: 15px; padding: 14px 28px; min-width: min(260px, 100%); }
.practice .button-success { background: var(--green-dark); border-color: var(--green-dark); }
.practice .button-success:hover, .practice .button-success:focus { background: #fff; color: var(--green-dark); }
.practice .button-error { background: var(--red); border-color: var(--red); }
.practice .button-error:hover, .practice .button-error:focus { background: #fff; color: var(--red); }
.practice .button-secondary { padding: 9px 20px; }

.answer-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 22px; margin: 4px 0 10px; }

/* Small links under the tools */
.tool-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin: 22px 0 0; }
.tool-links a { font-size: 15px; }

/* ---------- Tables (score, scoring chart, results) ---------- */
.practice .pure-table, .practice-frame .pure-table {
  margin: 0 auto; border: 0; border-collapse: collapse; background: #fff; color: var(--text); font-size: 15px;
}
.practice .pure-table thead, .practice-frame .pure-table thead { background: #fff; color: var(--ink); }
.practice .pure-table th, .practice-frame .pure-table th { font-weight: 700; color: var(--ink); border-bottom: 2px solid var(--ink); padding: 8px 12px; }
.practice .pure-table td, .practice-frame .pure-table td { border-left: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; vertical-align: middle; }
.practice .pure-table-bordered td, .practice-frame .pure-table-bordered td { border-left: 1px solid var(--line); }
.practice .pure-table-odd td { background: #fafafa; }

/* Score of the hand (index.py result) */
.score-table { text-align: center; }
.score-table .pure-table { text-align: left; }
.score-table .pure-table td:first-child { font-size: 20px; font-weight: 700; color: var(--ink); text-align: center; width: 70px; }
.score-table .pure-table td:nth-child(2) { font-weight: 700; color: var(--ink); }

/* Verdict (index.py result) */
.verdict-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 26px; margin: 0 0 6px; }
.verdict { display: inline-flex; align-items: center; gap: 14px; }
.verdict-word { display: inline-block; padding: 6px 16px; color: #fff; background: var(--ink); font: 400 18px/1.4 Montserrat, sans-serif; letter-spacing: 2px; text-transform: uppercase; }
.verdict-ok .verdict-word { background: var(--green-dark); }
.verdict-wrong .verdict-word { background: var(--red); }
.verdict-pts { font-size: 15px; color: var(--text); }
.verdict-pts b { font-size: 24px; color: var(--ink); margin-right: 6px; vertical-align: -2px; }

/* Scoring chart (index.py, "Show scoring chart") */
.help-wrap { margin-top: 22px; }
.help-table { width: 100%; min-width: 760px; table-layout: fixed; }
.practice .help-table th, .practice .help-table td { text-align: center; font-size: 12px; line-height: 1.5; vertical-align: top; padding: 8px 6px; }
.help-table .pts-col { width: 52px; }
.help-table .pts { font-size: 16px; font-weight: 700; color: var(--ink); }
.help-more { text-align: center; font-size: 14px; margin: 12px 0 0; }

/* ---------- Find all waits (index2.py) ---------- */
.hidden_hand { display: none; }
.hidden_hand iframe { display: block; margin-top: 18px; }
.wait-picker { text-align: center; }
.wait-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 18px; }
.practice .wait_button, .practice .wait_button.button-success, .practice .wait_button.button-error { flex: 0 0 auto; }
.practice .wait_button { padding: 5px; margin: 0; background: #fff; border-color: var(--line); }
.practice .wait_button img { width: 55px; display: block; }
.practice .wait_button.button-success { background: var(--green-100); border-color: var(--green); box-shadow: 0 0 0 2px var(--green); min-width: 0; padding: 5px; }
.practice .wait_button.button-error { background: #fbecec; border-color: var(--red); box-shadow: 0 0 0 2px var(--red); min-width: 0; padding: 5px; }
.practice .wait_button.button-error img { opacity: .45; }
.practice #validate_button { background: var(--purple); color: #fff; font-size: 14px; padding: 12px 30px; }
.practice #validate_button:hover, .practice #validate_button:focus { background: #fff; color: var(--purple-dark); }

/* The hand shown in index2_iframe.py */
.practice-frame { margin: 0; padding: 4px 6px 10px; background: transparent; font: 400 15px/1.5 Lato, "Helvetica Neue", Arial, sans-serif; color: var(--text); text-align: center; }
.practice-frame img { vertical-align: middle; }
.practice-frame .pure-table td:first-child { font-weight: 700; color: var(--ink); background: #fafafa; }
@media (max-width: 860px) { .practice-frame .pure-table { zoom: .75; } }
@media (max-width: 640px) { .practice-frame .pure-table { zoom: .6; } }
@media (max-width: 540px) { .practice-frame .pure-table { zoom: .48; } }
.practice-frame .tiles { white-space: nowrap; }

/* ---------- How can you wait? (index_waiting.py) ---------- */
.practice-wait { -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
.practice-wait img, .tile_selection img { -webkit-user-drag: none; user-drag: none; }
.tile-tray { text-align: center; margin: 0 0 22px; padding: 16px 18px 8px; background: var(--grey-bg); }
.tray-title, .drop-card p { font-weight: 700; color: var(--ink); margin: 0 0 12px; }
.drop-card p b { color: var(--red); }
.tile-picker { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 36px; }
.tile_selection_group { white-space: nowrap; }
.tile_selection { display: inline-table; width: 40px; margin-right: -1px; height: 64px; position: relative; cursor: grab; }
.tile_selection img { height: 64px; max-width: none; }
.tray-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.tray-buttons .pure-button { margin: 8px 0; min-width: 150px; }
.drop-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.drop-card { flex: 1 1 300px; max-width: 100%; padding: 14px 12px 12px; text-align: center; background: #fff; border: 1px solid var(--line); }
.drop-card p { min-height: 34px; }
.tile_empty { text-align: left; vertical-align: middle; margin-top: 5px; padding: 0; font-size: 1.2em; height: 64px; background: url(../images/frame.png); display: inline-block; }
.tile_empty_w { text-align: left; vertical-align: middle; margin-top: 5px; padding: 0; font-size: 1.2em; height: 64px; display: inline-block; zoom: .7; }
.tile_empty_hover { background: url(../images/frame_hover.png); }
.pung_tiles, .chow_tiles, .picked_tiles { width: 287px; }
.pung_tiles_w, .chow_tiles_w, .picked_tiles_w { width: 400px; }
.wrong-tiles { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #e3b9b9; font-size: 13px; color: var(--red-dark); }
.wrong_tile:after { content: " "; z-index: 10; display: block; position: absolute; height: 100%; top: 0; left: 0; right: 0; background: rgba(255, 0, 0, .5); }
.tile_pung, .tile_chow, .tile_picked { cursor: pointer; }

.result { display: none; }
.results { margin-top: 22px; }
.results .result > p { font-size: 15px; text-align: center; margin: 0 0 12px; }
.results .result > p img { vertical-align: middle; }
.practice .table_waits { width: 100%; min-width: 760px; table-layout: fixed; font-size: 14px; }
.practice .table_waits td { vertical-align: top; text-align: center; padding: 8px; }
.practice .table_waits th { padding: 10px 8px; text-align: center; }
.practice .table_waits th:nth-child(1), .practice .table_waits th:nth-child(4) { width: 90px; }
.practice .table_waits th:nth-child(2) { width: 120px; }
@media (max-width: 767px) { .practice .table_waits { zoom: .7; } }
@media (max-width: 560px) { .practice .table_waits { zoom: .5; } }
.practice .table_waits td:last-child { font-size: 18px; font-weight: 700; color: var(--ink); vertical-align: middle; }
.practice .table_waits .mat { text-align: left; }

/* ---------- Phones ---------- */
@media (max-width: 767px) {
  .practice { padding: 18px 12px 26px; }
  .board-fit { margin-bottom: 18px; }
  .practice .button-success, .practice .button-error { font-size: 14px; padding: 12px 18px; flex: 1 1 100%; }
  .practice .wait_button img { width: 44px; }
  .tile-tray { padding: 12px 6px 4px; }
  .tile-picker { gap: 8px 20px; }
  .tray-buttons .pure-button { min-width: 0; flex: 1 1 30%; padding: 10px 8px; letter-spacing: 1px; }
}
