/* Tiny Island support – shared styles of the player side and the staff panel.
   Mobile first; the frames and buttons are 9-slice pictures (border-image), only their plain centres stretch. */
:root {
	--ink: #3b2410;
	--muted: #7a6040;
	--parchment: #f3e3bd;
	--cream: #fffaf0;
	--accent: #e8562a;
	--focus: #2fa6c4;
	--radius: 10px;
	color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0; min-height: 100vh; color: var(--ink);
	font: 15px/1.45 "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
	background: #48b5cf url(img/s1_tlo_gracz.jpg) center / cover fixed no-repeat;
}
body.side-staff { background: #1f3f52 url(img/s1b_tlo_obsluga.jpg) center / cover fixed no-repeat; }
a { color: #8a3d12; }
img { max-width: 100%; }
h1 { font-size: 1.35rem; margin: 0 0 .6em; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .5em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- top bar (S3) ---- */
.topbar {
	position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; min-height: 60px;
	padding: 6px 4px 12px; color: #fff8e6;
	border: 0 solid transparent; border-width: 0 34px; border-image: url(img/s3_pasek.png) 0 120 fill / 0 34px stretch;
}
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: bold; font-size: 1.05rem;
	text-shadow: 0 2px 0 var(--ink); min-width: 0; }
.brand img { width: 30px; height: 30px; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topnav form { margin: 0; }

/* language menu */
.langs { position: relative; flex: none; }
.langs summary { list-style: none; cursor: pointer; padding: 6px; display: flex; }
.langs summary::-webkit-details-marker { display: none; }
.langs summary img { flex: none; }
.langs summary img, .langs-list img { width: 26px; height: 18px; border: 1px solid rgba(0,0,0,.35); border-radius: 2px; }
.langs-list { position: absolute; right: 0; top: 100%; min-width: 170px; padding: 8px; display: grid; gap: 2px;
	background: var(--parchment); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.langs-list a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.langs-list a:hover, .langs-list a.on { background: #ffe7b0; }

/* ---- layout ---- */
.main { width: 100%; max-width: 1060px; margin: 0 auto; padding: 14px 8px 40px; }
.cols { display: flex; flex-direction: column; gap: 14px; }
.with-mascot { display: flex; flex-direction: column; align-items: center; gap: 0; }
.mascot { display: block; height: auto; }
.mascot-help { width: 170px; margin-bottom: -26px; position: relative; z-index: 1; }
.side-mascot { display: none; }
.mascot-wide { display: block; width: min(100%, 520px); height: auto; margin: 0 auto; }
.mascot-wide.sent { width: min(100%, 420px); margin-bottom: -10px; }

/* ---- panel (S2): parchment in a wooden frame ---- */
.panel {
	position: relative; padding: 6px 8px;
	border: 20px solid transparent; border-image: url(img/s2_panel.png) 88 fill / 40px;
}
.panel-narrow { width: 100%; max-width: 440px; }

/* ---- buttons (S4) ---- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px;
	font: bold 1rem/1.1 inherit; font-family: inherit; color: #fff; text-decoration: none; cursor: pointer; white-space: nowrap;
	text-shadow: 0 1px 0 var(--ink), 0 0 3px var(--ink); background: none;
	border: 0 solid transparent; border-image: url(img/s4_drewno_normal.png) 12 28 fill / 10px 22px;
}
.btn:hover { border-image-source: url(img/s4_drewno_hover.png); }
.btn:active { border-image-source: url(img/s4_drewno_pressed.png); transform: translateY(1px); }
.btn-green { border-image-source: url(img/s4_zielony_normal.png); }
.btn-green:hover { border-image-source: url(img/s4_zielony_hover.png); }
.btn-green:active { border-image-source: url(img/s4_zielony_pressed.png); }
.btn-red { border-image-source: url(img/s4_czerwony_normal.png); }
.btn-red:hover { border-image-source: url(img/s4_czerwony_hover.png); }
.btn-red:active { border-image-source: url(img/s4_czerwony_pressed.png); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: .9rem; border-image-width: 8px 18px; }
.btn-big { min-height: 52px; padding: 0 28px; font-size: 1.12rem; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ---- form fields (S5) ---- */
label { display: block; font-weight: bold; margin: 12px 0 4px; }
.field {
	display: block; width: 100%; color: var(--ink); font: 1rem/1.4 inherit; font-family: inherit;
	padding: 11px 14px; background: #fffaf0;
	border: 2px solid #c49a5c; border-radius: 10px;
	box-shadow: inset 0 2px 4px rgba(90, 55, 20, .12);
	transition: border-color .15s, box-shadow .15s;
}
.field:hover { border-color: #a87a3c; }
.field:focus { outline: none; border-color: #8a5a2b; box-shadow: inset 0 2px 4px rgba(90, 55, 20, .12), 0 0 0 3px rgba(240, 150, 42, .35); }
.field::placeholder { color: #a8946f; }
textarea.field, .field.area { resize: vertical; min-height: 150px; }
select.field { appearance: none; cursor: pointer; padding-right: 40px;
	background: #fffaf0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%238a5a2b' stroke-width='2.5'/%3E%3C/svg%3E") right 14px center no-repeat; }

/* category tiles (S9) */
.categories { border: 0; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.categories legend { font-weight: bold; margin-bottom: 6px; padding: 0; }
.category { margin: 0; font-weight: normal; cursor: pointer; }
.category input { position: absolute; opacity: 0; pointer-events: none; }
.category-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; text-align: center; font-size: .85rem;
	background: var(--cream); border: 3px solid #d9c08a; border-radius: 12px; height: 100%; transition: transform .1s; }
.category-tile .cat-icon { width: 52px; height: 52px; }
.category:hover .category-tile { transform: translateY(-2px); }
.category input:checked + .category-tile { background: #ffe7b0; border-color: #8a5a2b; box-shadow: 0 0 0 2px #f0962a inset; }
.category input:focus-visible + .category-tile { outline: 3px solid var(--focus); }
.cat-icon { width: 48px; height: 48px; flex: none; }
.cat-icon.small { width: 34px; height: 34px; }

/* account card */
.account-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.warn { display: flex; align-items: center; gap: 6px; font-weight: bold; }

/* the player's face (game layers) */
.face { position: relative; display: inline-block; flex: none; width: 60px; height: 70px; overflow: hidden; border-radius: 10px;
	background: #d6b874; border: 3px solid var(--ink); }
.face img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.face-big { width: 78px; height: 91px; }
.face.avatar { width: 52px; height: 52px; border-radius: 50%; }
.face.avatar img { width: 128%; height: auto; left: -14%; top: -6%; }

/* ---- status badges (S8) ---- */
.badge {
	display: inline-flex; align-items: center; min-height: 30px; padding: 0 14px 0 34px; flex: none; white-space: nowrap;
	color: #fff; font-weight: bold; font-size: .82rem; text-shadow: 0 1px 0 var(--ink), 0 0 2px var(--ink);
	border: 0 solid transparent; border-image: url(img/s8_nowe.png) 10 20 10 44 fill / 8px 16px 8px 32px;
}
.badge-open { border-image-source: url(img/s8_w_toku.png); }
.badge-waiting { border-image-source: url(img/s8_czeka.png); }
.badge-resolved { border-image-source: url(img/s8_rozwiazane.png); }
.badge-closed { border-image-source: url(img/s8_zamkniete.png); }

/* ---- ticket list ---- */
.tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ticket-row a { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "icon subject subject" "icon badge time";
	align-items: center; gap: 4px 10px; padding: 10px 12px; color: var(--ink); text-decoration: none;
	background: var(--cream); border: 2px solid #d9c08a; border-radius: 10px; }
.ticket-row a:hover { border-color: #8a5a2b; }
.ticket-row.unread a { background: #fff3d6; font-weight: bold; }
.ticket-row .cat-icon { grid-area: icon; }
.ticket-no { display: none; }
.ticket-subject { grid-area: subject; min-width: 0; overflow-wrap: anywhere; }
.ticket-row .badge { grid-area: badge; justify-self: start; }
.ticket-time { grid-area: time; font-size: .85rem; font-weight: normal; }
.dot { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; background: url(img/s7_licznik.png) center / contain no-repeat; }
.empty { text-align: center; padding: 6px 0 10px; }
.empty p { margin: 8px auto 14px; max-width: 420px; }

/* ---- ticket view ---- */
.ticket-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 3px dashed #d9c08a; }
.ticket-head h1 { margin: 0; overflow-wrap: anywhere; }
.conversation { padding: 12px 0; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg-staff { flex-direction: row-reverse; }
.msg-body { min-width: 0; max-width: 100%; flex: 0 1 auto; }
.msg-staff .meta { text-align: right; }
.meta { font-size: .78rem; color: var(--muted); margin: 0 6px 2px; }
.avatar { width: 52px; height: 52px; flex: none; }
.bubble { padding: 10px 18px 24px; overflow-wrap: anywhere;
	border: 0 solid transparent; border-image: url(img/s15_gracz.png) 42 60 60 60 fill / 21px 30px 30px 30px; }
.msg-staff .bubble { border-image-source: url(img/s15_support.png); }
.msg-note .bubble { border-image-source: url(img/s15_notatka.png); padding-top: 18px; }
.event { align-self: center; display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); text-align: center; }
.note-box { background: #fff3d6; border: 2px dashed #d9a54a; border-radius: 10px; padding: 10px 12px; margin: 6px 0 0; }
.reply { border-top: 3px dashed #d9c08a; padding-top: 6px; }
.close-ticket { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* ---- toasts (S19) ---- */
.toast {
	max-width: 640px; margin: 0 auto 12px; min-height: 58px; display: flex; align-items: center; padding: 8px 16px 8px 74px;
	font-weight: bold; border: 0 solid transparent; border-image: url(img/s19_sukces.png) 18 28 18 88 fill / 12px 18px 12px 56px;
}
.toast-error { border-image-source: url(img/s19_blad.png); }
.toast-info { border-image-source: url(img/s19_informacja.png); }

/* ---- wider screens ---- */
@media (min-width: 600px) {
	.main { padding: 22px 16px 48px; }
	.categories { grid-template-columns: repeat(4, 1fr); }
	.panel { padding: 8px 14px; border-width: 24px; border-image-width: 44px; }
	.ticket-row a { grid-template-columns: auto auto 1fr auto auto; grid-template-areas: "icon no subject badge time"; }
	.ticket-no { display: inline; grid-area: no; color: var(--muted); }
	.msg-body { max-width: 75%; }
	.mascot-help { width: 200px; }
}
@media (min-width: 900px) {
	/* form + account card: one centred block, the card stays a fixed narrow column */
	.cols { display: grid; grid-template-columns: minmax(0, 1fr) 290px; align-items: start; gap: 18px; }
	.account { position: sticky; top: 84px; }
	.with-mascot { flex-direction: row; justify-content: center; align-items: center; gap: 10px; }
	.with-mascot .mascot-help { width: 260px; margin: 0; }
}
@media (max-width: 599px) {
	.ticket-head h1 { font-size: 1.12rem; }
	.ticket-head { display: grid; grid-template-columns: auto 1fr; }
	.ticket-head .badge { order: -1; grid-column: 1 / -1; justify-self: end; }
}
@media (max-width: 420px) {
	.hide-narrow { display: none; }
	.topnav .btn span { display: none; }
	.topnav .btn { padding: 0 10px; }
	.brand span { font-size: .95rem; }
}

/* bug / idea form: two big tiles; platform and hint only for the chosen kind */
.categories-two { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
.categories-two .category-tile { padding: 14px 10px; gap: 6px; font-size: 1rem; }
.categories-two .category-tile .cat-icon { width: 72px; height: 72px; }
.categories-two .category-tile small { font-size: .8rem; color: #6b5636; line-height: 1.35; }
.platforms { display: none; border: 0; padding: 0; margin: 12px 0 0; flex-wrap: wrap; gap: 8px; }
.platforms legend { font-weight: bold; margin-bottom: 6px; padding: 0; width: 100%; }
.platform { margin: 0; font-weight: normal; cursor: pointer; }
.platform input { position: absolute; opacity: 0; pointer-events: none; }
.platform span { display: inline-block; padding: 8px 14px; border: 2px solid #c9a26a; border-radius: 20px; background: #fff7e2; }
.platform input:checked + span { background: #ffe7b0; border-color: #8a5a2b; box-shadow: 0 0 0 2px #f0962a inset; font-weight: bold; }
.platform input:focus-visible + span { outline: 3px solid var(--focus); }
.new-ticket:has(.category-bug input:checked) .platforms { display: flex; }
.hints .hint { display: none; margin: 0 0 6px; font-size: .9rem; color: #6b5636; }
.new-ticket:has(.category-bug input:checked) .hint-bug,
.new-ticket:has(.category-idea input:checked) .hint-idea { display: block; }

/* ---- home (my tickets): greeting + two action tiles, list + "how it works" ---- */
.home-top { display: grid; gap: 12px; margin-bottom: 14px; }
.greeting { display: flex; align-items: center; gap: 14px; }
.greeting h1 { margin: 0 0 2px; }
.action-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--ink); text-decoration: none;
	background: var(--cream); border: 3px solid #d9c08a; border-radius: 14px; transition: transform .1s, border-color .1s; }
.action-tile:hover { transform: translateY(-2px); border-color: #8a5a2b; }
.action-tile .cat-icon { width: 60px; height: 60px; }
.action-tile strong { display: block; font-size: 1.1rem; }
.action-tile small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.3; }
.action-bug { background: #fff1e8; }
.action-idea { background: #fff8dc; }
.home-cols { display: grid; gap: 14px; align-items: start; }
.list-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.list-head h2 { margin: 0 auto 0 0; }
.list-tabs { display: flex; gap: 6px; }
.list-tabs a { padding: 6px 12px; border: 2px solid #c9a26a; border-radius: 20px; background: #fff7e2; color: var(--ink); text-decoration: none; font-size: .9rem; }
.list-tabs a span { color: var(--muted); margin-left: 2px; }
.list-tabs a[aria-current="page"] { background: #ffe7b0; border-color: #8a5a2b; font-weight: bold; }
.empty-mini { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 2px dashed #d9c08a; border-radius: 12px; }
.empty-mini img { width: 170px; height: auto; flex: none; }
.empty-mini p { margin: 0; }
.steps { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.steps li { display: flex; align-items: flex-start; gap: 10px; }
.steps li::before { counter-increment: step; content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%;
	background: #8a5a2b; color: #fff8e6; font-weight: bold; font-size: .85rem; display: flex; align-items: center; justify-content: center; }
.steps .ico { width: 24px; height: 24px; }
.tip { align-items: flex-start; padding-top: 10px; border-top: 2px dashed #d9c08a; font-weight: normal; }
@media (min-width: 600px) {
	.home-top { grid-template-columns: 1fr 1fr; }
	.greeting { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
	.home-top { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
	.greeting { grid-column: auto; }
	.home-cols { grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; }
	.how { position: sticky; top: 84px; }
}
@media (max-width: 599px) {
	.home-top { grid-template-columns: 1fr 1fr; }
	.greeting { grid-column: 1 / -1; }
	.action-tile { flex-direction: column; text-align: center; gap: 6px; padding: 10px 8px; }
	.action-tile .cat-icon { width: 48px; height: 48px; }
	.action-tile small { display: none; }
	.empty-mini img { width: 80px; }
}

/* ---- header without the wooden bar: logo, help tag, language and account pills (as on the home page) ---- */
.site-head { width: 100%; max-width: 1060px; margin: 0 auto; padding: 12px 8px 0; display: flex; align-items: center; gap: 10px; }
.site-logo { display: block; flex: none; line-height: 0; }
.site-logo img { width: auto; height: 72px; filter: drop-shadow(0 3px 4px rgba(4, 50, 77, .45)); }
.head-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px; border-radius: 22px;
	background: #063c45ed; color: #fff6dc; border: 1px solid rgba(255, 245, 216, .3); font-size: .9rem; font-weight: bold; white-space: nowrap; }
.head-tag .ico { width: 20px; height: 20px; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.head-langs { gap: 2px; padding: 3px; }
.head-langs > span { opacity: .6; margin: 0 2px; }
.head-langs a { min-width: 34px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
	color: #fff6dc; text-decoration: none; font-size: .8rem; }
.head-langs a[aria-current] { background: #fff0c9; color: #143b3b; }
.account-menu { position: relative; }
.account-menu summary { list-style: none; cursor: pointer; padding-left: 4px; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu .caret { width: 14px; height: 14px; transform: rotate(-90deg); opacity: .85; }
.account-menu[open] .caret { transform: rotate(90deg); }
.face.face-mini { width: 32px; height: 32px; border-radius: 50%; border-width: 2px; }
.face.face-mini img { width: 130%; height: auto; left: -15%; top: -4%; }
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.account-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px; display: grid; gap: 2px;
	background: var(--parchment); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 8px 20px rgba(0, 0, 0, .3); }
.account-list a, .account-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
	background: none; color: var(--ink); font: inherit; font-weight: bold; text-align: left; text-decoration: none; cursor: pointer; }
.account-list a:hover, .account-list button:hover { background: #ffe7b0; }
.account-list form { margin: 0; }
@media (max-width: 599px) {
	.site-logo img { height: 44px; }
	.head-tag { display: none; }
	.account-name { display: none; }
	.site-head { padding-top: 8px; gap: 6px; }
}

/* ---- live updates (support.js) ---- */
.actions .form-status, .actions .counter { margin-right: auto; align-self: center; }
.actions .form-status + .counter { margin-right: 0; }
.counter-low { color: #b0401a; font-weight: bold; }
.form-error { color: #b0401a; font-weight: bold; }
.head-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #d9342b; color: #fff; font-size: .75rem;
	display: inline-flex; align-items: center; justify-content: center; }
.head-badge[hidden] { display: none; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg-new { animation: msg-in .35s ease-out; }
@media (prefers-reduced-motion: reduce) { .msg-new { animation: none; } }

/* ---- light / dark / system (assets/theme.js sets data-theme on <html>) ---- */
html[data-theme="dark"] body { background-color: #0b1a33; background-image: url(img/s1_tlo_gracz_noc.jpg); }
html[data-theme="dark"] .site-logo img { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .6)); }
.head-theme { cursor: pointer; padding: 4px 10px; font: inherit; }
.head-theme .th-ico { width: 20px; height: 20px; display: none; }
html:not([data-theme-mode]) .head-theme .th-system,
html[data-theme-mode="system"] .head-theme .th-system,
html[data-theme-mode="light"] .head-theme .th-light,
html[data-theme-mode="dark"] .head-theme .th-dark { display: block; }

/* language menu (more than 3 languages, views/layout.php): the account menu's look, a scrollable list */
.lang-menu .lang-current { font-size: .85rem; font-weight: 700; }
.lang-list { min-width: 200px; max-height: min(70vh, 460px); overflow-y: auto; }
.lang-list a.on { background: #ffe7b0; font-weight: 700; }
