:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --border: #d9dde5;
  --text: #0f172a;
  --muted: #5f6b7a;
  --accent: #0f7a8a;
  --accent-strong: #0a5160;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 1rem;
}

p {
  margin: 6px 0;
}


a {
  color: var(--accent-strong);
}

h1,
h2,
h3 {
  margin: 0 0 8px;
  font-weight: 700;
}

h1 {
  font-size: 1.3rem;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1.05rem;
}

label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  max-width: none;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
}

input[type="radio"],
input[type="checkbox"] {
  width: auto;
  max-width: none;
}

[data-role="page"] {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

[data-role="header"] {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}

[data-role="content"] {
  padding: 16px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

[data-role="footer"],
.ui-bar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  justify-content: center;
}

[data-role="footer"] a,
.ui-bar a {
  flex: 1;
  text-align: center;
}

.ui-bar a.footer-compact,
[data-role="footer"] a.footer-compact {
  flex: 0 0 auto;
  padding: 4px 8px;
  min-height: 30px;
  font-size: 0.85rem;
  min-width: 0;
}

[data-role="button"],
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  margin: 6px 6px 6px 0;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.back-resp-button {
  margin-top: 24px;
  width: 50%;
  margin-left: auto;
  display: flex;
  justify-content: center;
}

.back-score-button {
  width: 100%;
  display: flex;
  justify-content: center;
}

[data-role="button"]:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

[data-role="button"]:active,
button:active,
input[type="submit"]:active,
input[type="button"]:active,
input[type="reset"]:active {
  transform: translateY(0);
  box-shadow: none;
}

[data-role="controlgroup"] {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

[data-role="controlgroup"][data-type="horizontal"] {
  flex-direction: row;
}

#teamselection {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#teamselection .control-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

#teamselection .control-option label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  width: 100%;
  font-size: 1rem;
}

#teamselection .control-option input[type="radio"] {
  margin: 0;
  width: 1.1rem;
  height: 1.1rem;
}

.spirit-controlgroup {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  width: 100%;
}

.spirit-controlgroup .spirit-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
  border-left: 1px solid var(--border);
}

.spirit-controlgroup .spirit-choice:first-child {
  border-left: none;
}

.spirit-controlgroup .spirit-choice label {
  margin: 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.spirit-controlgroup .spirit-choice input[type="radio"] {
  margin: 0;
  width: 1.0rem;
  height: 1.0rem;
}

.spirit-table {
  width: 100%;
  table-layout: fixed;
}

.spirit-table td,
.spirit-table th {
  width: auto;
}

.spirit-control-cell {
  width: 100%;
}

.scoreboard-table {
  width: 100%;
  border-collapse: collapse;
}

.scoreboard-table td {
  padding: 8px 10px;
}

.scoreboard-table tr:nth-child(odd) {
  background: #f5f7fb;
}

.scoreboard-table tr:nth-child(even) {
  background: #ffffff;
}

.gameplay-table {
  width: 100%;
  border-collapse: collapse;
}

.gameplay-table td {
  padding: 8px 10px;
}

.gameplay-row--goal.gameplay-row--home {
  background: #e9f7f0;
}

.gameplay-row--goal.gameplay-row--away {
  background: #eef2ff;
}

.gameplay-row--event {
  background: #fff7e6;
}

.gameplay-row--halftime {
  background: #fdecea;
  font-weight: 700;
}

[data-role="listview"] {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

[data-role="listview"] li {
  border-bottom: 1px solid var(--border);
}

[data-role="listview"] li:last-child {
  border-bottom: none;
}

[data-role="listview"] a {
  display: block;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
}

[data-role="listview"] a:hover {
  background: #eef3f7;
}

.resp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resp-list[data-role="listview"] {
  background: none;
  border: none;
  box-shadow: none;
}

.resp-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.resp-group-toggle,
.resp-location-toggle {
  display: block;
}

.resp-group-title,
.resp-location-title {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 18px;
}

.resp-group-title::-webkit-details-marker,
.resp-location-title::-webkit-details-marker {
  display: none;
}

.resp-group-title::after,
.resp-location-title::after {
  content: "▸";
  position: absolute;
  right: 0;
  top: 0;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.resp-group-toggle[open] > .resp-group-title::after,
.resp-location-toggle[open] > .resp-location-title::after {
  transform: rotate(90deg);
}

.resp-group-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.resp-location-title {
  font-weight: 600;
  color: var(--muted);
  margin: 6px 0;
}

.resp-location-list,
.resp-game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.resp-location {
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.resp-location:first-child {
  border-top: none;
  padding-top: 0;
}

.resp-game {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px 6px;
  background: #f9fbff;
}

.resp-game.resp-game--pending {
  background: #f1f6ff;
}

.resp-game.resp-game--ongoing {
  background: #ffe7e7;
}

.resp-game.resp-game--played {
  background: #eef8f2;
}

.resp-game-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0;
  font-size: 0.95rem;
}

.resp-time {
  font-weight: 700;
  color: var(--accent-strong);
}

.resp-teams {
  flex: 1 1 auto;
  min-width: 160px;
}

.resp-score {
  font-weight: 700;
  line-height: 1.1;
}

.resp-score a {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  background: #e9f0ff;
  color: var(--accent-strong);
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.resp-score a:hover {
  background: #dbe7ff;
  transform: translateY(-1px);
}

.resp-score a:focus {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.resp-status a {
  color: var(--accent-strong);
  font-weight: 600;
}

.resp-status {
  flex-basis: 100%;
  margin-top: 0;
  text-align: right;
  font-size: 0.8rem;
  font-variant: small-caps;
}

.resp-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 4px;
  margin-bottom: 0;
}

.resp-actions [data-role="button"] {
  width: 100%;
  font-size: 0.8rem;
  padding: 8px 6px;
  white-space: normal;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
}

@media (max-width: 520px) {
  .resp-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.resp-filter label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.85rem;
}

.resp-filter input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.resp-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ui-grid-b {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 0.8fr));
  gap: 10px;
  align-items: center;
  margin: 8px 0 14px;
}

.ui-grid-b [data-role="button"] {
  width: 100%;
}

.ui-grid-solo {
  margin: 6px 0 2px;
}

.ui-block-a,
.ui-block-b,
.ui-block-c {
  min-width: 0;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: grid;
  grid-template-columns: auto 1fr 5.5rem;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
}

.player-row:not(.player-row--header):nth-child(odd) {
  background: #f5f7fb;
}

.player-row:not(.player-row--header):nth-child(even) {
  background: #ffffff;
}

.player-row--header {
  font-size: 1rem;
  background: transparent;
}

.player-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.player-check input[type="checkbox"] {
  width: 1.4rem;
  height: 1.4rem;
}

.player-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-number select {
  width: 100%;
}

.action-row {
  display: grid;
  gap: 10px;
  margin: 10px 0;
}

.action-row--half {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-row--even {
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
}

.action-row--stacked {
  grid-template-columns: minmax(0, 1fr);
}

.action-row--spaced {
  gap: 18px;
}

.action-row [data-role="button"] {
  width: 100%;
}

.action-row input[type="submit"] {
  width: 100%;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.warning {
  color: #b54708;
  background: #fff7e6;
  border: 1px solid #f7c566;
  padding: 10px 12px;
  border-radius: 8px;
}

form {
  margin: 0;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
  background: var(--surface);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 4px;
}

.timeout-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 14px;
}

.timeout-pair {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: none;
}

.timeout-pair .ui-block-a,
.timeout-pair .ui-block-b {
  flex: 1 1 0;
  min-width: 0;
}

.timeout-pair select {
  width: 100%;
  min-width: 0;
}

.timeout-separator {
  font-weight: 700;
  color: var(--muted);
}

@media (min-width: 900px) {
  [data-role="content"] {
    padding: 24px;
  }
}
