/*
Copyright (C) 2020 Jan-Dirk van Dingenen

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Note:
The Isle of Cats boardgame designed by Frank West is copyright of The City of Games

*/

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Aclonica&display=swap');


::selection, button::selection {
background: transparent;
}
::-moz-selection, button::-moz-selection {
background: transparent;
}

*:not(input):not(textarea) {
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html {
    background-image: url(img/water.jpg);
    touch-action: manipulation;
}

body {
    margin:0;
}

#game {
    --size: 50px;
    --gameSize:var(--size);
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: space-around;
    min-height: 100vh;
    width: calc(var(--size) * 29);
    margin: 0 auto;
    cursor:default;
}

#game, button {
    font-family: 'Orbitron', monospace;
    font-size: calc(var(--size) * 0.19);
    text-transform: uppercase;
    font-weight: bold;
}

button {
    -webkit-appearance: none;
    border-radius: 0;
    background-color: #f0f0f0;
}

input[type=checkbox] {
    border-radius: 0;
}

#board {
    position: relative;
    width: calc(var(--size) * 22);
    height: calc(var(--size) * 9);
    filter: drop-shadow(calc(var(--size) * 0.2) calc(var(--size) * 0.2) calc(var(--size) * 0.3) black);
}

.header {
    font-family: 'Aclonica', sans-serif;
    font-size: calc(var(--size) * 0.3);
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: calc(var(--size) * 0.25);
}

.tile {
    width: var(--size);
    height: var(--size);
    border: solid 1px #000;
    box-sizing: border-box;
    position: absolute;
    left: calc(var(--size) * var(--tileX));
    top: calc(var(--size) * var(--tileY));
    box-shadow: 0 0 0 1px #000;
    background-position: bottom right;
    background-color: #b28864;
    background-size: cover, 40%;
    background-repeat: no-repeat;
    background-blend-mode: multiply;
}

.tile.captain2, .tile.deck  {
    background-image: url(img/wood.jpg);
    background-color: #8e6542;
}

.tile.captain, .tile.captain2 {
    background-image: url(img/wood.jpg), url(img/parrot.svg);    
}

.tile.bed, .tile.bed2 {
    background-image: url(img/wood.jpg), url(img/moon.svg);
}

.tile.store {
   background-image: url(img/wood.jpg), url(img/wheat.svg);
}

.tile.dining {
    background-image: url(img/wood.jpg), url(img/apple.svg);
}


.tile.rat:after {
    content: "";
    position: absolute;
    width: calc(var(--size) * 1);
    height: calc(var(--size) * 1);
    background-size: 80%;
    background-repeat: no-repeat;
    background-image: url(img/rat.svg);
    filter: drop-shadow(0px 0px 1px white);
}

.tile.map:after {
    content: "";
    position: absolute;
    width: calc(var(--size) * 1);
    height: calc(var(--size) * 1);
    background-size: 80%;
    background-repeat: no-repeat;        
        filter: drop-shadow(0px 0px 1px #fff) drop-shadow(0px 0px 1px #fff);
}

.tile.map_blue:after {
    background-image: url(img/map_blue.svg);
}

.tile.map_green:after {
    background-image: url(img/map_green.svg);
}

.tile.map_yellow:after {
    background-image: url(img/map_yellow.svg);
    filter: drop-shadow(0px 0px 1px #000) drop-shadow(0px 0px 1px #000) drop-shadow(0px 0px 1px #fff) drop-shadow(0px 0px 1px #fff);
}

.tile.map_red:after {
    background-image: url(img/map_red.svg);
}
.tile.map_purple:after {
    background-image: url(img/map_purple.svg);
}

#top, #catControl, #scoring, #specials, #history {
    border: solid 2px #303030;
    padding: calc(var(--size) * 0.3);
    border-radius: calc(var(--size) * 0.2);
    background-color: #f0f0f0;
    box-sizing: border-box;
    background-image: url(img/white.jpg);
    background-blend-mode: lighten;
    position: relative;
    box-shadow: calc(var(--size) * 0.1) calc(var(--size) * 0.1) calc(var(--size) * 0.3) rgba(0,0,0,0.5), inset 0 0 calc(var(--size) * 0.2) rgb(0, 92, 123), inset 0 0 calc(var(--size) * 0.1) rgb(0, 32, 43);
}

#lessons {
    display: grid;
    grid-template-columns: auto auto auto;
    grid-template-rows: auto auto auto auto auto;
    grid-auto-flow: column;
    column-gap: calc(var(--size) * 0.25);
}

.lesson input {
    width: calc(var(--size) * 0.4);
    height: calc(var(--size) * 0.4);
    border: solid 1px #000;
    vertical-align: middle;
}

.lessonText {
    cursor: default;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    line-height: calc(var(--size) * 0.3);
    white-space: normal;
}

.popup {
    position: absolute;
    color: #303030;
    top: calc(var(--size) * -0.25);
    left: 50%;
    transform: translate(-50%,-100%);
    background-color: #fff;
    border: solid 1px #000;
    padding: calc(var(--size) * 0.19);
    border-radius: calc(var(--size) * 0.1);
    display: inline-block;
    white-space: nowrap;
    box-sizing: border-box;
}

.popup:after {
    content: "";
    position: absolute;
    width: calc(var(--size) * 0.15);
    height: calc(var(--size) * 0.25);
    border: solid 1px #000;
    left: 50%;
    bottom: 0;
    transform: translate(-50%,calc(100% - 1px));
    border-top-color: #fff;
    background-color: #fff;
    border-bottom-right-radius: 100%;
    box-sizing: border-box;
    z-index: 1;
}

#middle {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

#bottom {
    display: flex;
    justify-content: space-between;
    width: 100%;
}


#scoreList {
    display: inline-grid;
    grid-template-columns: auto auto;
    column-gap: calc(var(--size) * 0.5);
    grid-auto-flow: column;
    grid-template-rows: auto auto auto auto auto;
}

.scoreLine {
    display: flex;
    justify-content: space-between;
    padding: calc(var(--size) * 0.05);
    height: calc(var(--size) * 0.3);
}

.scoreLine:last-child {
    border-top: solid 1px;
}

#scoreList .scoreText {
    position: relative;
}

.scoreValue {
    text-align: right;
    margin-left: calc(var(--size) * 0.5);
}

.specialTypes {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: calc(var(--size) * 0.5);
}

#drawColours {
    display: inline-flex;
    flex-direction: column;
    vertical-align: top;
    justify-content: space-between;
    height: calc(var(--size) * 8.3);
}

.catColour {
    width: calc(var(--size) * 1.1);
    height: calc(var(--size) * 1.1);
    cursor: pointer;
    border: solid 3px #a0a0a0;
    box-sizing: border-box;
    border-radius: calc(var(--size) * 0.1);
}

.catColour_red {
    --catColour: #94000A;
    border-color: var(--catColour);
    background-image:url(img/cat_red.svg);
    background-color: #ff8a92;
}

.catColour_blue {
    --catColour: #00297b;
    border-color: var(--catColour);
    background-image:url(img/cat_blue.svg);
    background-color: #6e9eff;
}

.catColour_green {
    --catColour: #057b00;
    border-color: var(--catColour);
    background-image:url(img/cat_green.svg);
    background-color: #5eff58;
}

.catColour_yellow {
    --catColour: #9aa200;
    border-color: var(--catColour);
    background-image:url(img/cat_yellow.svg);
    background-color: #edf296;
}

.catColour_purple {
    --catColour: #6800a2;
    border-color: var(--catColour);
    background-image:url(img/cat_purple.svg);
    background-color: #c55dff;
}

.catColour_rare {
    --catColour: #e3d015;
    border-color: var(--catColour);
    background-image:url(img/rareTreasure.svg);
    background-color: #fffbd6;
}

.catColour_common {
    --catColour: #e39015;
    border-color: var(--catColour);
    background-image:url(img/commonTreasure.svg);
    background-color: #fee4be;
}

.catColour.selected {
    border-radius: calc(var(--size) * 0.1);
    background-color: #000;
    box-sizing: border-box;
}

#controlButtons {
    display: inline-block;
}

#controlButtons button, button#deletePiece {
    display: block;
    visibility:hidden;
    width: calc(var(--size) * 2);
    margin-bottom: calc(var(--size) * 0.5);
    height: calc(var(--size) * 1);
    margin-left: calc(var(--size) * 0.5);
    cursor: pointer;
    border-radius: 0;
}

button#deletePiece {
    position: absolute;
    bottom: calc(var(--size) * 0.6);
    right: calc(var(--size) * 0.3);
    visibility:visible;
}

.boardPiece {
    width: calc(var(--size) - 2px);
    height: calc(var(--size) - 2px);
    border-style: solid;
    border-width: calc(var(--size) * 0.1);
    box-sizing: border-box;
    position: absolute;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    z-index:5;
}

.deleteMode {
    position: absolute;
    top: calc(var(--size) * 0.5);
    left: 50%;
    transform: translate(-50%, 0);
    z-index: 10;
    color: #a00;
    font-size: calc(var(--size) * 0.8);
    text-shadow: 0 0 1px #fff, 0 0 1px #fff, 0 0 1px #fff, 0 0 2px #000;
    pointer-events: none;
    white-space: nowrap;
    font-weight: bold;
    opacity: 0.9;
}

.boardPiece.noBorder_0 {
    border-top-width: 0;
}

.boardPiece.noBorder_1 {
    border-right-width: 0;
}

.boardPiece.noBorder_2 {
    border-bottom-width: 0;
}

.boardPiece.noBorder_3 {
    border-left-width: 0;
}

.currentCat {
    opacity: 0.6;
}

#families {
    display: inline-block;
    vertical-align: bottom;
    margin-left: calc(var(--size) * 1);
}

#familyTable {
    padding-left: calc(var(--size) * 0.1);
    display: grid;
    grid-template-columns: auto auto auto;
}

.lessonPassed {
    color: #0a0;
}

.lessonFailed {
    color: #a00;
}

.icon {
    width: calc(var(--size) * 0.25);
    height: calc(var(--size) * 0.25);
    display: inline-block;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.icon.captain {
    background-image: url(img/parrot.svg), url(img/parrot.svg);    
}

.icon.bed {
    background-image: url(img/moon.svg), url(img/moon.svg);
}

.icon.store {
   background-image: url(img/wheat.svg), url(img/wheat.svg);
}

.icon.dining {
    background-image: url(img/apple.svg), url(img/apple.svg);
}

#history {
    min-width: calc(var(--size) * 4);
}

#history .header {
    width: calc(var(--size) * 3);
}

#historyContainer {
    height: calc(var(--size) * 2.3);
    width: calc(var(--size) * 3.2);
    padding-right: calc(var(--size) * 0.1);
    overflow-y: auto;    
}

#historyContainer::-webkit-scrollbar {
    width: calc(var(--size) * 0.15);
    height: calc(var(--size) * 0.15);
}
 
#historyContainer::-webkit-scrollbar-track {
    background-color: rgba(48, 48, 48, 0.14);
}
 
#historyContainer::-webkit-scrollbar-thumb {
    box-shadow: inset 0 0 calc(var(--size) * 0.15) #e8e8e8;
    background-color: #303030;
}

.historyItem {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: calc(var(--size) * 0.25);
    padding: calc(var(--size) * 0.1);
    padding-bottom: calc(var(--size) * 0.2);
    border: solid 1px #000;
    border-radius: calc(var(--size) * 0.1);
    background-color: rgba(0, 0, 0, 0.05);
    width: calc(var(--size) * 2.5);
    margin-left: auto;
    margin-right: auto;
}

.historyShape {
    position: relative;
    --shapeSize: calc(var(--size) * 0.25);
    min-width: calc(var(--shapeSize) * var(--widthX));
    min-height: calc(var(--shapeSize) * var(--heightY));
    margin-top: calc(var(--size) * 0.2);
}

.shapePart {
    position: absolute;
    width: var(--shapeSize);
    height: var(--shapeSize);
    box-sizing: border-box;
    border-style: solid;
    border-width: calc(var(--shapeSize) * 0.25);
    left: calc(var(--shapeX) * calc(var(--size) * 0.25));
    top: calc(var(--shapeY) * calc(var(--size) * 0.25));
}

button#newRound {
    position: absolute;
    top: calc(var(--size) * 0.1);
    right: calc(var(--size) * 0.1);
    font-size: calc(var(--size) * 0.15);
    height: calc(var(--size) * 0.7);
    cursor: pointer;
}

.historyItem.historyRound {
    background: unset;
    border: 0;
}

.catLink::selection, .catLink a::selection  {
    background: #038fff;
    color:#fff;
}
.catLink::selection, .catLink a::-moz-selection {
    background: #038fff;
    color:#fff;
}

.catLinkContainer {
    display:flex;
}

input.catLink {
    border: solid 1px #a0a0a0;
    padding: calc(var(--size) * 0.1);
    border-right: none;
}

#copyButton {
    cursor:pointer;
}

#copyButton img {
    height: calc(var(--size) * 0.4);
}

button.newGame {
    font-size: calc(var(--size) * 0.3);
    width: 100%;
    margin-top: calc(var(--size) * 0.25);
    height: calc(var(--size) * 1);
    cursor:pointer;
    color: #0e77ca;
}

.historyItem.historyLesson, .historyItem.historySpecial {
    background: #638fb2;
    font-size: calc(var(--size) * 0.17);
    width: auto;
    color: #fff;
    text-shadow: 1px 1px 1px #000;
    padding-bottom: calc(var(--size) * 0.1);
    border-radius: calc(var(--size) * 0.06);
    filter: unset;
    position: relative;
    margin-top: calc(var(--size) * 0.4);
    font-family: sans-serif;
    text-transform: initial;
}

.historyItem.historyLesson:after, .historyItem.historySpecial:after {
    transform: translate(0,-100%);
    content: "Lesson";
    position: absolute;
    top: 0;
    color: #f9f9f9;
    background: #638fb2;
    padding: 0 calc(var(--size) * 0.1);
    height: calc(var(--size) * 0.22);
    border: solid 1px #000;
    border-bottom: 0;
    border-radius: calc(var(--size) * 0.06) calc(var(--size) * 0.06) 0 0;
    z-index: 2;
}

.historyItem.historySpecial {
    background: #9b3e80;
}

.historyItem.historySpecial:after {
    content: "Special";
    background: #9b3e80;
}

.historyText {
    width: calc(var(--size) * 2.5);
    text-align: center;
}

.historyText .icon {
    filter: invert(1);
    width: calc(var(--size) * 0.2);
    height: calc(var(--size) * 0.2);
}

#history.popout {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-100%,-50%);
    z-index: 100;
    height: 90vh;
    padding: calc(var(--size) * 0.3) calc(var(--size) * 0.5);
    box-shadow: calc(var(--size) * 0.2) calc(var(--size) * 0.2) calc(var(--size) * 0.6) #000;
}

.popout #historyContainer {
    height: 80vh;
    width: calc(var(--size) * 5);
}

.popout .historyText, .popout .historyLesson:after, .popout .historyItem.historySpecial:after {
    font-size: calc(var(--size) * 0.3);
}

button#popout {
    background-size: contain;
    position: absolute;
    top: calc(var(--size) * 0.2);
    left: calc(var(--size) * 0.2);
    height: calc(var(--size) * 0.5);
    width: calc(var(--size) * 0.5);
    cursor: pointer;
    padding: 0;
    outline:none;
}

button#popout img {
    width: calc(var(--size) * 0.25);
    height: calc(var(--size) * 0.25);
}

.readOnly #catControl {
    height: calc(var(--size) * 5);
    text-align: center;
}

.readOnly .scoreLine:last-child .scoreValue {
    font-size: calc(var(--size) * 0.5);
}

.readOnly .tile {
    border: solid 1px transparent;
}

#specials .lessonText {
    max-width: calc(var(--size) * 6);
}

#top .lessonText {
    width: calc(var(--size) * 8.7);
}

.tile.filledTile.map:after {
    z-index: 10;
    width: calc(var(--size) * 0.5);
    height: calc(var(--size) * 0.5);
}

button.collapseButton {
    background-size: contain;
    position: absolute;
    top: calc(var(--size) * 0.2);
    left: calc(var(--size) * 0.2);
    height: calc(var(--size) * 0.5);
    width: calc(var(--size) * 0.5);
    cursor: pointer;
    padding: 0;
    padding-top: 0px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-left: 0px;
    outline: none;
    font-weight: normal;
    font-size: calc(var(--size) * 0.3);
}

.collapse {
    height: calc(var(--size) * 1);
    overflow: hidden;    
}

.subheader {
    text-align: center;
    color: #909090;
    font-size: calc(var(--size) * 0.17);
    margin-bottom: calc(var(--size) * 0.2);
}

#lessons .lesson {
    white-space: nowrap;
}

/*  -----------------  screenshots: replace SVG by PNG files -----------------  */

#screenshotButton {
    position: absolute;
    bottom: calc(var(--size) * 0.3);
    right: calc(var(--size) * 0.3);
    width: calc(var(--size) * 2);
}

.screenshot #catControl {
    display:none;
}

.screenshot #middle {
    justify-content:center;
}

.screenshot:not(.viewmode) #game {
    background-image: url(img/water.jpg);
}

.screenshot:not(.viewmode) .tile {
    background-size: 40%;
}

.screenshot:not(.viewmode) .tile.captain, .screenshot:not(.viewmode) .tile.captain2 {
    background-image: url(img/parrot.png);
}

.screenshot:not(.viewmode) .tile.dining {
    background-image: url(img/apple.png);
}

.screenshot:not(.viewmode) .tile.bed, .screenshot:not(.viewmode) .tile.bed2 {
    background-image: url(img/moon.png);
}

.screenshot:not(.viewmode) .tile.store {
    background-image:  url(img/wheat.png);
}

.screenshot:not(.viewmode) .tile.rat:after {
    background-image: url(img/rat.png);
}

.screenshot:not(.viewmode) .tile.map_yellow:after {
    background-image: url(img/map_yellow.png);
}

.screenshot:not(.viewmode) .tile.map_green:after {
    background-image: url(img/map_green.png);
}

.screenshot:not(.viewmode) .tile.map_blue:after {
    background-image: url(img/map_blue.png);
}

.screenshot:not(.viewmode) .tile.map_red:after {
    background-image: url(img/map_red.png);
}

.screenshot:not(.viewmode) .tile.map_purple:after {
    background-image: url(img/map_purple.png);
}

.screenshot:not(.viewmode) .tile.deck {
    background-image:none;
}

.screenshot:not(.viewmode) .catColour_green {
    background-image:url(img/cat_green.png);
}

.screenshot:not(.viewmode) .catColour_blue {
    background-image:url(img/cat_blue.png);
}

.screenshot:not(.viewmode) .catColour_red {
    background-image:url(img/cat_red.png);
}

.screenshot:not(.viewmode) .catColour_yellow {
    background-image:url(img/cat_yellow.png);
}

.screenshot:not(.viewmode) .catColour_purple {
    background-image:url(img/cat_purple.png);
}

.screenshot:not(.viewmode) .catColour_rare {
    background-image:url(img/rareTreasure.png);
}

.screenshot:not(.viewmode) .catColour_common {
    background-image:url(img/commonTreasure.png);
}

.screenshot #popout, .screenshot #others {
    display:none;
}

.viewmode #history button#popout {
    display: block;
}

.viewmode #history.popout {
    left: 0 !important;
    transform: translate(0,-50%);
}

.boatOnly #top, .boatOnly #bottom {
    display:none;
}

.boatOnly #middle {
    --size: calc(var(--gameSize) * 1.25);
}

/*  ---------------------------- */

#others {
    position: absolute;
    top: 5px;
    right: 50px;
    font-size: 80%;
    font-family: Verdana, sans-serif;
    z-index: 10000;
    text-align: right;
}

#others a {
    color: #000;
    text-shadow: 1px 0 1px #fff;
}

#others a:hover {
    color: #fff;
    text-shadow: 1px 0 1px #000;
}
